Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 64f9f7b

Browse filesBrowse files
bug #21927 [FrameworkBundle] Add missing resource tracking for validation mapping (chalasr)
This PR was merged into the 3.3-dev branch. Discussion ---------- [FrameworkBundle] Add missing resource tracking for validation mapping | Q | A | ------------- | --- | Branch? | master | Bug fix? | yes | New feature? | no | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | #19086 (comment) | License | MIT | Doc PR | n/a https://github.com/symfony/symfony/pull/21927/files?w=1 Commits ------- 0a19cbe Add missing resource tracking for validation mapping
2 parents 5b1a96a + 0a19cbe commit 64f9f7b
Copy full SHA for 64f9f7b

File tree

1 file changed

+6
-4
lines changed
Filter options

1 file changed

+6
-4
lines changed

‎src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php

Copy file name to clipboardExpand all lines: src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php
+6-4Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
use Symfony\Bridge\Monolog\Processor\DebugProcessor;
1616
use Symfony\Component\Cache\Adapter\AdapterInterface;
1717
use Symfony\Component\Config\Loader\LoaderInterface;
18+
use Symfony\Component\Config\Resource\DirectoryResource;
1819
use Symfony\Component\DependencyInjection\Alias;
1920
use Symfony\Component\DependencyInjection\ChildDefinition;
2021
use 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

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.