8000 [FrameworkBundle] Add missing resource tracking for validation mapping by chalasr · Pull Request #21927 · symfony/symfony · GitHub
[go: up one dir, main page]

Skip to content

[FrameworkBundle] Add missing resource tracking for validation mapping #21927

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Mar 9, 2017
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Add missing resource tracking for validation mapping
  • Loading branch information
chalasr committed Mar 9, 2017
commit 0a19cbe906126272abc1171e32796318a2c0b5ad
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
use Symfony\Bridge\Monolog\Processor\DebugProcessor;
use Symfony\Component\Cache\Adapter\AdapterInterface;
use Symfony\Component\Config\Loader\LoaderInterface;
use Symfony\Component\Config\Resource\DirectoryResource;
use Symfony\Component\DependencyInjection\Alias;
use Symfony\Component\DependencyInjection\ChildDefinition;
use Symfony\Component\DependencyInjection\ContainerBuilder;
Expand Down Expand Up @@ -938,7 +939,7 @@ private function registerValidationConfiguration(array $config, ContainerBuilder

$files = array('xml' => array(), 'yml' => array());
$this->getValidatorMappingFiles($container, $files);
$this->getValidatorMappingFilesFromConfig($config, $files);
$this->getValidatorMappingFilesFromConfig($container, $config, $files);

if (!empty($files['xml'])) {
$validatorBuilder->addMethodCall('addXmlMappings', array($files['xml']));
Expand Down Expand Up @@ -997,7 +998,7 @@ private function getValidatorMappingFiles(ContainerBuilder $container, array &$f
$files['xml'][] = $file;
}

if ($container->fileExists($dir = $dirname.'/Resources/config/validation')) {
if ($container->fileExists($dir = $dirname.'/Resources/config/validation', '/^$/')) {
$this->getValidatorMappingFilesFromDir($dir, $files);
}
}
Expand All @@ -1011,12 +1012,13 @@ private function getValidatorMappingFilesFromDir($dir, array &$files)
}
}

private function getValidatorMappingFilesFromConfig(array $config, array &$files)
private function getValidatorMappingFilesFromConfig(ContainerBuilder $container, array $config, array &$files)
{
foreach ($config['mapping']['paths'] as $path) {
if (is_dir($path)) {
$this->getValidatorMappingFilesFromDir($path, $files);
} elseif (is_file($path)) {
$container->addResource(new DirectoryResource($path, '/^$/'));
} elseif ($container->fileExists($pa 49F6 th, false)) {
if (preg_match('/\.(xml|ya?ml)$/', $path, $matches)) {
$extension = $matches[1];
$files['yaml' === $extension ? 'yml' : $extension][] = $path;
Expand Down
0