FOSRestBundle: How to Avoid Automatic Pluralization of POST /login Route?

旧街凉风 提交于 2019-12-12 09:57:02

问题


I have this Action to handle the user login also via REST api call:

/**
 * Login Action
 *
 * @param Request $request
 */
public function postLoginAction(Request $request)
{

This is what php app/console router:debug shows me:

en__RG__post_login                          POST     ANY    ANY  /api/1/logins.{_format}

In this case the automatic pluralization to "logins" is not so nice... any ideas how to get only "login"?


回答1:


You can manage default route pluralization by overriding fos_rest.inflector.doctrine service. refer this issue and followed pull request.

or

for change pluralization of single route it can be done by using Manual definition of routes please refer this documentation from FOSRESTBUNDLE repository



来源:https://stackoverflow.com/questions/22394765/fosrestbundle-how-to-avoid-automatic-pluralization-of-post-login-route

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!