1515use Symfony \Bridge \Monolog \Processor \DebugProcessor ;
1616use Symfony \Component \Cache \Adapter \AdapterInterface ;
1717use Symfony \Component \Config \Loader \LoaderInterface ;
18+ use Symfony \Component \Config \Resource \DirectoryResource ;
1819use Symfony \Component \DependencyInjection \Alias ;
1920use Symfony \Component \DependencyInjection \ChildDefinition ;
2021use Symfony \Component \DependencyInjection \ContainerBuilder ;
@@ -938,7 +939,7 @@ private function registerValidationConfiguration(array $config, ContainerBuilder
938939
939940 $ files = array ('xml ' => array (), 'yml ' => array ());
940941 $ this ->getValidatorMappingFiles ($ container , $ files );
941- $ this ->getValidatorMappingFilesFromConfig ($ config , $ files );
942+ $ this ->getValidatorMappingFilesFromConfig ($ container , $ config , $ files );
942943
943944 if (!empty ($ files ['xml ' ])) {
944945 $ validatorBuilder ->addMethodCall ('addXmlMappings ' , array ($ files ['xml ' ]));
@@ -997,7 +998,7 @@ private function getValidatorMappingFiles(ContainerBuilder $container, array &$f
997998 $ files ['xml ' ][] = $ file ;
998999 }
9991000
1000- if ($ container ->fileExists ($ dir = $ dirname .'/Resources/config/validation ' )) {
1001+ if ($ container ->fileExists ($ dir = $ dirname .'/Resources/config/validation ' , ' /^$/ ' )) {
10011002 $ this ->getValidatorMappingFilesFromDir ($ dir , $ files );
10021003 }
10031004 }
@@ -1011,12 +1012,13 @@ private function getValidatorMappingFilesFromDir($dir, array &$files)
10111012 }
10121013 }
10131014
1014- private function getValidatorMappingFilesFromConfig (array $ config , array &$ files )
1015+ private function getValidatorMappingFilesFromConfig (ContainerBuilder $ container , array $ config , array &$ files )
10151016 {
10161017 foreach ($ config ['mapping ' ]['paths ' ] as $ path ) {
10171018 if (is_dir ($ path )) {
10181019 $ this ->getValidatorMappingFilesFromDir ($ path , $ files );
1019- } elseif (is_file ($ path )) {
1020+ $ container ->addResource (new DirectoryResource ($ path , '/^$/ ' ));
1021+ } elseif ($ container ->fileExists ($ path , false )) {
10201022 if (preg_match ('/\.(xml|ya?ml)$/ ' , $ path , $ matches )) {
10211023 $ extension = $ matches [1 ];
10221024 $ files ['yaml ' === $ extension ? 'yml ' : $ extension ][] = $ path ;
0 commit comments