diff --git a/src/Symfony/Bundle/FrameworkBundle/Controller/ControllerResolver.php b/src/Symfony/Bundle/FrameworkBundle/Controller/ControllerResolver.php index 804a4f8038..8ec7fe99cf 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Controller/ControllerResolver.php +++ b/src/Symfony/Bundle/FrameworkBundle/Controller/ControllerResolver.php @@ -57,8 +57,18 @@ class ControllerResolver extends BaseControllerResolver protected function createController($controller) { if (false === strpos($controller, '::')) { - // must be a controller in the a:b:c notation then - $controller = $this->converter->fromShortNotation($controller); + $count = substr_count($controller, ':'); + if (2 == $count) { + // controller in the a:b:c notation then + $controller = $this->converter->fromShortNotation($controller); + } elseif (1 == $count) { + // controller in the service:method notation + list($service, $method) = explode(':', $controller); + + return array($this->container->get($service), $method); + } else { + throw new \LogicException(sprintf('Unable to parse the controller name "%s".', $controller)); + } } list($class, $method) = explode('::', $controller); diff --git a/src/Symfony/Bundle/FrameworkBundle/Routing/DelegatingLoader.php b/src/Symfony/Bundle/FrameworkBundle/Routing/DelegatingLoader.php index 73534e6d99..344b95250e 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Routing/DelegatingLoader.php +++ b/src/Symfony/Bundle/FrameworkBundle/Routing/DelegatingLoader.php @@ -60,7 +60,7 @@ class DelegatingLoader extends BaseDelegatingLoader try { $controller = $this->converter->fromShortNotation($controller); } catch (\Exception $e) { - throw new \RuntimeException(sprintf('%s (for route "%s" in resource "%s")', $e->getMessage(), $name, is_string($resource) ? $resource : 'RESOURCE'), $e->getCode(), $e); + // unable to optimize unknown notation } $route->setDefault('_controller', $controller);