I'm currently working on a RESTful API using Symfony2 with FOSRestBundle.
I love Mongodb, so i've implemented just that, here is a snippet of my usercontroller.
/**
* @return View view instance
* @View()
*/
public function allAction() {
$users = $this->get('doctrine_mongodb')
->getRepository('FantasytdUserBundle:User')
->findByUsername('Elvar');
return $users;
}
So i am finding a User in the Database, which yields a result. Were this done with mysql database this snippet would work. But with mongodb, the get method returns a Cursor object, and when this is returned, you get something like this.
[{"message":"[Semantical Error] Annotation @Secure is not allowed to be declared on class JMS\\SecurityExtraBundle\\Annotation\\Secure. You may only use this annotation on these code elements: METHOD.","class":"Doctrine\\Common\\Annotations\\AnnotationException","trace":[{"namespace":"","short_class":"","class":"","type":"","function":"","file":"\/Users\/Elvar\/Projects\/fantasytd\/backend\/vendor\/doctrine\/common\/lib\/Doctrine\/Common\/Annotations\/AnnotationException.php","line":52,"args":[]},
And it goes on.
How should i approach these cursor objects?