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

[FrameworkBundle] Add default mapping path for validator component in bundle-less app #24856

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
Nov 10, 2017
Merged
Show file tree
Hide file tree
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 default mapping path for validator component
  • Loading branch information
yceruto committed Nov 7, 2017
commit 4e0daecc63ff006a982d4aac005f1490af86d19b
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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();

Expand Down Expand Up @@ -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]);
Expand All @@ -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
Expand Down Expand Up @@ -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]);
Expand Down
Morty Proxy This is a proxified and sanitized view of the page, visit original site.