【发布时间】:2016-11-19 03:03:29
【问题描述】:
我开始使用 symfony3 和 FOSRestBundle 为 REST API 创建一个新项目。一切都按预期工作,但我有一个问题。我在控制器和路由器配置上有这两个操作:
api_marcas_get_all_marca_paginated GET ANY ANY /api/marca/{limit}/{page}.{_format}
api_marcas_delete_remove_marca GET ANY ANY /api/marca/delete/{marcaid}.{_format}
问题是当我调用这个(来自邮递员)时:
127.0.0.1:8000/api/marca/delete/105
另一个动作 (api_marcas_get_all_marca_paginated) 响应...
是的..我知道我可以使用“DELETE”http 方法,并且这是有效的...但是...为什么它们会发生冲突?
这是我的行动:
/**
* @Rest\Get("/marca/{limit}/{page}")
*/
public function getAllMarcaPaginatedAction(Request $request)
{... code here ...}
和
/**
* @Rest\Get("/marca/delete/{marcaid}")
*/
public function deleteRemoveMarcaAction(Request $request)
{ ... //code here... }
按那个顺序。
我做错了什么? 与动作的顺序有什么关系?谢谢...
【问题讨论】:
标签: php rest annotations symfony fosrestbundle