Skip to content

[FrameworkBundle] No way to specify validation config outside of the bundle #22772

@sonu27

Description

@sonu27
Q A
Bug report? yes
Feature request? no
BC Break report? no
RFC? no
Symfony version 3.3.0-RC1

After speaking with @weaverryan and looking at

private function registerValidatorMapping(ContainerBuilder $container, array $config, array &$files)
{
$fileRecorder = function ($extension, $path) use (&$files) {
$files['yaml' === $extension ? 'yml' : $extension][] = $path;
};
if (interface_exists('Symfony\Component\Form\FormInterface')) {
$reflClass = new \ReflectionClass('Symfony\Component\Form\FormInterface');
$fileRecorder('xml', dirname($reflClass->getFileName()).'/Resources/config/validation.xml');
}
foreach ($container->getParameter('kernel.bundles_metadata') as $bundle) {
$dirname = $bundle['path'];
if ($container->fileExists($file = $dirname.'/Resources/config/validation.yml', false)) {
$fileRecorder('yml', $file);
}
if ($container->fileExists($file = $dirname.'/Resources/config/validation.xml', false)) {
$fileRecorder('xml', $file);
}
if ($container->fileExists($dir = $dirname.'/Resources/config/validation', '/^$/')) {
$this->registerMappingFilesFromDir($dir, $fileRecorder);
}
}
$this->registerMappingFilesFromConfig($container, $config, $fileRecorder);
}
we believe the only way to add configuration is within the bundle.

It should be possible to read the validation config from the etc or newly proposed config directory, searching for a file named validation.yaml or similar.

I'd really like this as part of 3.3 if possible.

Are we correct in thinking this? Could it be done for 3.3?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions