[Symfony2] Extract the current namespace, bundle, controller and action name
$matches = array(); $controller = $this->getRequest()->attributes->get('_controller'); preg_match('/(.*)\\\Bundle\\\(.*)\\\Controller\\\(.*)Controller::(.*)Action/', $controller, $matches); $request = $this->getRequest(); $request->attributes->set('namespace', $matches[1]); $request->attributes->set('bundle', $matches[2]); $request->attributes->set('controller', $matches[3]); $request->attributes->set('action', $matches[4]);
Labels: symphony2
0 Comments:
Post a Comment
<< Home