FOSRestBundle:如何避免 POST/login 路由的自动复数? [英] FOSRestBundle: How to Avoid Automatic Pluralization of POST /login Route?
问题描述
我也有这个 Action 来通过 REST api 调用来处理用户登录:
I have this Action to handle the user login also via REST api call:
/**
* Login Action
*
* @param Request $request
*/
public function postLoginAction(Request $request)
{
这是php app/console router:debug
给我看的:
en__RG__post_login POST ANY ANY /api/1/logins.{_format}
在这种情况下,logins"的自动复数形式不太好......有什么想法如何只获得login"?
In this case the automatic pluralization to "logins" is not so nice... any ideas how to get only "login"?
推荐答案
您可以通过覆盖 fos_rest.inflector.doctrine
服务来管理默认路由复数.参考这个问题并遵循拉取请求.
You can manage default route pluralization by overriding fos_rest.inflector.doctrine
service. refer this issue and followed pull request.
或
对于改变单个路由的复数可以通过使用手动定义路由来完成,请参考本文档 来自 FOSRESTBUNDLE 存储库
for change pluralization of single route it can be done by using Manual definition of routes please refer this documentation from FOSRESTBUNDLE repository
这篇关于FOSRestBundle:如何避免 POST/login 路由的自动复数?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!