Symfony 2.3.4 と FOSRestBundle 0.13.1 を使用しています。ルートが FOSRestBundle によって自動生成されるように構成しました。@QueryParam アノテーションを任意のメソッドに追加するまで、すべてがうまく機能します。このアノテーションはルートを変更し、変数を URL から抽出する代わりに、パラメーターとして渡されることを期待します。
すなわち
/**
* @return array
* @Rest\View
*/
public function getDetailsAction($user) {
......
}
-bash-4.2$ php app/console router:debug
get_details GET ANY ANY /api/users/details/{user}
しかし、@QueryParam アノテーションを追加するとすぐに、ルートが次のように変更されます。
/**
* @QueryParam(name="user", requirements="\w+", strict=true, nullable=false, description="Name of the user to query details for")
* @return array
* @Rest\View
*/
public function getDetailsAction($user) {
......
}
-bash-4.2$ php app/console router:debug
get_details GET ANY ANY /api/users/details
ルートが変更されるのはなぜですか? 元のルートを保持し、同時に @QueryParam アノテーションを使用することはできませんか?