From 78883f90a6dbb778ca3e96b3093ad0c8e7ea3e66 Mon Sep 17 00:00:00 2001 From: docteurklein Date: Tue, 18 Oct 2011 16:22:42 +0200 Subject: [PATCH] Allow syntax like ``{% render "AcmeDemoBundle:Frontend/Default:index" %}`` Bug fix: yes Feature addition: yes Backwards compatibility break: no Symfony2 tests pass: yes Fixes the following tickets: #2424 --- .../Controller/ControllerNameParser.php | 1 + .../Controller/ControllerNameParserTest.php | 2 ++ .../Controller/Test/DefaultController.php | 21 +++++++++++++++++++ 3 files changed, 24 insertions(+) create mode 100644 src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/TestBundle/FooBundle/Controller/Test/DefaultController.php diff --git a/src/Symfony/Bundle/FrameworkBundle/Controller/ControllerNameParser.php b/src/Symfony/Bundle/FrameworkBundle/Controller/ControllerNameParser.php index d1c53bab22..089fbc4fda 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Controller/ControllerNameParser.php +++ b/src/Symfony/Bundle/FrameworkBundle/Controller/ControllerNameParser.php @@ -49,6 +49,7 @@ class ControllerNameParser } list($bundle, $controller, $action) = $parts; + $controller = str_replace('/', '\\', $controller); $class = null; $logs = array(); foreach ($this->kernel->getBundle($bundle, false) as $b) { diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/Controller/ControllerNameParserTest.php b/src/Symfony/Bundle/FrameworkBundle/Tests/Controller/ControllerNameParserTest.php index 5171139e2a..3314fe8ced 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/Controller/ControllerNameParserTest.php +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/Controller/ControllerNameParserTest.php @@ -44,6 +44,8 @@ class ControllerNameParserTest extends TestCase $this->assertEquals('TestBundle\FooBundle\Controller\Sub\DefaultController::indexAction', $parser->parse('FooBundle:Sub\Default:index'), '->parse() converts a short a:b:c notation string to a class::method string'); $this->assertEquals('TestBundle\Fabpot\FooBundle\Controller\DefaultController::indexAction', $parser->parse('SensioFooBundle:Default:index'), '->parse() converts a short a:b:c notation string to a class::method string'); $this->assertEquals('TestBundle\Sensio\Cms\FooBundle\Controller\DefaultController::indexAction', $parser->parse('SensioCmsFooBundle:Default:index'), '->parse() converts a short a:b:c notation string to a class::method string'); + $this->assertEquals('TestBundle\FooBundle\Controller\Test\DefaultController::indexAction', $parser->parse('FooBundle:Test\\Default:index'), '->parse() converts a short a:b:c notation string to a class::method string'); + $this->assertEquals('TestBundle\FooBundle\Controller\Test\DefaultController::indexAction', $parser->parse('FooBundle:Test/Default:index'), '->parse() converts a short a:b:c notation string to a class::method string'); try { $parser->parse('foo:'); diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/TestBundle/FooBundle/Controller/Test/DefaultController.php b/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/TestBundle/FooBundle/Controller/Test/DefaultController.php new file mode 100644 index 0000000000..c5ade69034 --- /dev/null +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/TestBundle/FooBundle/Controller/Test/DefaultController.php @@ -0,0 +1,21 @@ + + * + * This source file is subject to the MIT license that is bundled + * with this source code in the file LICENSE. + */ + +/** + * DefaultController. + * + * @author Fabien Potencier + */ +class DefaultController +{ +}