|
15 | 15 | use Symfony\Bridge\Monolog\Processor\DebugProcessor;
|
16 | 16 | use Symfony\Component\Cache\Adapter\AdapterInterface;
|
17 | 17 | use Symfony\Component\Config\Loader\LoaderInterface;
|
| 18 | +use Symfony\Component\Config\Resource\DirectoryResource; |
| 19 | +use Symfony\Component\Config\Resource\FileExistenceResource; |
18 | 20 | use Symfony\Component\DependencyInjection\Alias;
|
19 | 21 | use Symfony\Component\DependencyInjection\ChildDefinition;
|
20 | 22 | use Symfony\Component\DependencyInjection\ContainerBuilder;
|
@@ -938,7 +940,7 @@ private function registerValidationConfiguration(array $config, ContainerBuilder
|
938 | 940 |
|
939 | 941 | $files = array('xml' => array(), 'yml' => array());
|
940 | 942 | $this->getValidatorMappingFiles($container, $files);
|
941 |
| - $this->getValidatorMappingFilesFromConfig($config, $files); |
| 943 | + $this->getValidatorMappingFilesFromConfig($container, $config, $files); |
942 | 944 |
|
943 | 945 | if (!empty($files['xml'])) {
|
944 | 946 | $validatorBuilder->addMethodCall('addXmlMappings', array($files['xml']));
|
@@ -1011,12 +1013,13 @@ private function getValidatorMappingFilesFromDir($dir, array &$files)
|
1011 | 1013 | }
|
1012 | 1014 | }
|
1013 | 1015 |
|
1014 |
| - private function getValidatorMappingFilesFromConfig(array $config, array &$files) |
| 1016 | + private function getValidatorMappingFilesFromConfig(ContainerBuilder $container, array $config, array &$files) |
1015 | 1017 | {
|
1016 | 1018 | foreach ($config['mapping']['paths'] as $path) {
|
1017 | 1019 | if (is_dir($path)) {
|
1018 | 1020 | $this->getValidatorMappingFilesFromDir($path, $files);
|
1019 |
| - } elseif (is_file($path)) { |
| 1021 | + $container->addResource(new DirectoryResource($path, '/^$/')); |
| 1022 | + } elseif ($container->fileExists($path, false)) { |
1020 | 1023 | if (preg_match('/\.(xml|ya?ml)$/', $path, $matches)) {
|
1021 | 1024 | $extension = $matches[1];
|
1022 | 1025 | $files['yaml' === $extension ? 'yml' : $extension][] = $path;
|
|
0 commit comments