FOSRestBundle:如何避免 POST/login 路由的自动复数? [英] FOSRestBundle: How to Avoid Automatic Pluralization of POST /login Route?

查看:51
本文介绍了FOSRestBundle:如何避免 POST/login 路由的自动复数?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我也有这个 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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆