dodanie customowego pliku do walidacji

class ValidatorPass implements CompilerPassInterface
{
    public function process(ContainerBuilder $container)
    {
        $validatorBuilder = $container->getDefinition('validator.builder');

        $validationYmlPath = $container->getParameter('enp_address.validation_yml_path');
        $appDir = $container->getParameter('kernel.root_dir');

        $file = new SplFileInfo($appDir.'/../../'.$validationYmlPath);

        $validatorFiles = [$file->getRealpath()];
        $validatorBuilder->addMethodCall('addYamlMappings', [$validatorFiles]);
    }
}
Komentarze wyłączone