diff --git a/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php b/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php index 2844bbc783e2c..37dcba8977951 100644 --- a/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php +++ b/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php @@ -1290,6 +1290,11 @@ private function registerValidatorMapping(ContainerBuilder $container, array $co } } + $projectDir = $container->getParameter('kernel.project_dir'); + if ($container->fileExists($dir = $projectDir.'/config/validator', '/^$/')) { + $this->registerMappingFilesFromDir($dir, $fileRecorder); + } + $this->registerMappingFilesFromConfig($container, $config, $fileRecorder); } diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/FrameworkExtensionTest.php b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/FrameworkExtensionTest.php index 8b2841dc9ab60..3908b02103055 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/FrameworkExtensionTest.php +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/FrameworkExtensionTest.php @@ -543,9 +543,13 @@ public function testTemplatingRequiresAtLeastOneEngine() public function testValidation() { $container = $this->createContainerFromFile('full'); + $projectDir = $container->getParameter('kernel.project_dir'); $ref = new \ReflectionClass('Symfony\Component\Form\Form'); - $xmlMappings = array(dirname($ref->getFileName()).'/Resources/config/validation.xml'); + $xmlMappings = array( + dirname($ref->getFileName()).'/Resources/config/validation.xml', + strtr($projectDir.'/config/validator/foo.xml', '/', DIRECTORY_SEPARATOR), + ); $calls = $container->getDefinition('validator.builder')->getMethodCalls(); @@ -633,7 +637,7 @@ public function testValidationPaths() $this->assertEquals(array(new Reference('validator.mapping.cache.symfony')), $calls[7][1]); $xmlMappings = $calls[3][1][0]; - $this->assertCount(2, $xmlMappings); + $this->assertCount(3, $xmlMappings); try { // Testing symfony/symfony $this->assertStringEndsWith('Component'.DIRECTORY_SEPARATOR.'Form/Resources/config/validation.xml', $xmlMappings[0]); @@ -659,7 +663,7 @@ public function testValidationPathsUsingCustomBundlePath() $calls = $container->getDefinition('validator.builder')->getMethodCalls(); $xmlMappings = $calls[3][1][0]; - $this->assertCount(2, $xmlMappings); + $this->assertCount(3, $xmlMappings); try { // Testing symfony/symfony @@ -701,7 +705,7 @@ public function testValidationMapping() $calls = $container->getDefinition('validator.builder')->getMethodCalls(); $this->assertSame('addXmlMappings', $calls[3][0]); - $this->assertCount(2, $calls[3][1][0]); + $this->assertCount(3, $calls[3][1][0]); $this->assertSame('addYamlMappings', $calls[4][0]); $this->assertCount(3, $calls[4][1][0]); diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/config/validator/foo.xml b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/config/validator/foo.xml new file mode 100644 index 0000000000000..e69de29bb2d1d