私は現在、FOSRestBundleでSymfony2を使用してRESTfulAPIに取り組んでいます。
私はMongodbが大好きなので、それを実装しました。これが私のユーザーコントローラーのスニペットです。
/**
* @return View view instance
* @View()
*/
public function allAction() {
$users = $this->get('doctrine_mongodb')
->getRepository('FantasytdUserBundle:User')
->findByUsername('Elvar');
return $users;
}
だから私はデータベースでユーザーを見つけています。それは結果をもたらします。これがmysqlデータベースで行われた場合、このスニペットは機能します。しかし、mongodbでは、getメソッドはCursorオブジェクトを返し、これが返されると、次のようなものが得られます。
[{"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":[]},
そしてそれは続く。
これらのカーソルオブジェクトにどのようにアプローチする必要がありますか?