FOSRestBundle: How to Avoid Automatic Pluralizatio

2019-05-10 12:53发布

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条回答
叛逆
2楼-- · 2019-05-10 13:39

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

查看更多
登录 后发表回答