public function build($controller) { if ('\\' === substr($controller, 0, 1)) { $controller = substr($controller, 1); } return parent::build($controller); }
/** * Parses request controller and returns vendor, bundle, controller, action * * @param string $controller * @return array */ protected function parseRequestController($controller) { if (!is_string($controller)) { return array(); } if (array_key_exists($controller, $this->parserCache)) { return $this->parserCache[$controller]; } $result = array(); if ($this->isControllerActionFullName($controller)) { // Format: "Foo\BarBundle\Controller\BazController::indexAction" $controllerActionKey = $this->parser->build($controller); $controllerFullName = $controller; } elseif ($this->isControllerActionShortName($controller)) { // Format: "FooBarBundle:BazController:index" $controllerActionKey = $controller; $controllerFullName = $this->parser->parse($controller); } else { // Format with service id: "foo_bar_bundle.baz_controller:indexAction" // Cannot be used to parse vendor, bundle, controller, action return $result; } $controllerNameParts = explode('::', $controllerFullName); $vendorName = current(explode('\\', $controllerNameParts[0])); list($bundleName, $controllerName, $actionName) = explode(':', $controllerActionKey); return $this->parserCache[$controller] = array('vendor' => $vendorName, 'bundle' => $bundleName, 'controller' => $controllerName, 'action' => $actionName); }