When following Symfony2's validation documentation (http://symfony.com/doc/current/book/validation.html) the writer often refers to
src/Acme/BlogBundle/Resources/config/validation.yml
I also have this file, at the proper location (accounting for my bundle name and vendor ofcourse) but it is completely ignored.
Do I need to load this from somewhere?
You don't have to load the validation.yml programmaticaly. You just modify the config.yml to enable validation and to disable annotations:
framework:
validation: { enabled: true, enable_annotations: false }
You need to load this in your Extension file src/Acme/BlogBundle/DependencyInjection/AcmeBlogExtension.php.
public function load(array $configs, ContainerBuilder $container)
{
//...
$yamlMappingFiles = $container->getParameter('validator.mapping.loader.yaml_files_loader.mapping_files');
$yamlMappingFiles[] = __DIR__.'/../Resources/config/validation.yml';
$container->setParameter('validator.mapping.loader.yaml_files_loader.mapping_files', $yamlMappingFiles);
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With