How to get current bundle in Symfony 2?

后端 未结 4 1010
盖世英雄少女心
盖世英雄少女心 2021-02-03 11:09

How can I detect in which bundle am I?

for exemple, when I\'m in web.com/participants/list, I want to read \"participants\".

4条回答
  •  清歌不尽
    2021-02-03 12:03

    Well you can get the controller of the current route by,

    $request->attributes->get('_controller');
    

    You can parse the bundle name from it.

提交回复
热议问题