最近我从 Symfony 2.4 转移到 Symfony 2.7
所以我在关注新文档。现在说我action functions
在同一个控制器中有 2 个。
public function indexAction() {}
public function changeRateAction()
以前我会使用routing.yml
change_interest_rate_label:
path: /change_interest_rate
defaults: { _controller: appBundle:appInterestRateChange:index }
change_interest_rate_action_label:
path: /change_interest_rate_and_archived_action
defaults: { _controller: appBundle:appInterestRateChange:changeRate }
现在在 2.7 文档中,鼓励使用注释。内部controller
文件
/**
* @Route("/home", name="homepage")
*/
这将触发控制器文件中包含的操作方法。但是如何为同一控制器文件中包含的不同 url 的 2 种方法编写注释?
这意味着我在同一个控制器文件中有indexAction
& 。changeRateAction
我想/home
用 index 函数和/change
changeRate 函数路由 url。如何使用注释来做到这一点?我知道如何使用routing.yml