* * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Symfony\Component\Validator\DependencyInjection; use Symfony\Component\DependencyInjection\ContainerBuilder; use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface; use Symfony\Component\DependencyInjection\Compiler\ServiceLocatorTagPass; use Symfony\Component\DependencyInjection\Reference; /** * @author Johannes M. Schmitt * @author Robin Chalas */ class AddConstraintValidatorsPass implements CompilerPassInterface { private $validatorFactoryServiceId; private $constraintValidatorTag; public function __construct($validatorFactoryServiceId = 'validator.validator_factory', $constraintValidatorTag = 'validator.constraint_validator') { $this->validatorFactoryServiceId = $validatorFactoryServiceId; $this->constraintValidatorTag = $constraintValidatorTag; } public function process(ContainerBuilder $container) { if (!$container->hasDefinition($this->validatorFactoryServiceId)) { return; } $validators = array(); foreach ($container->findTaggedServiceIds($this->constraintValidatorTag, true) as $id => $attributes) { $definition = $container->getDefinition($id); if (isset($attributes[0]['alias'])) { $validators[$attributes[0]['alias']] = new Reference($id); } $validators[$definition->getClass()] = new Reference($id); } $container ->getDefinition($this->validatorFactoryServiceId) ->replaceArgument(0, ServiceLocatorTagPass::register($container, $validators)) ; } } __halt_compiler();----SIGNATURE:----GHI/UAxtA78301SRN8VcBnsMOlWhy9ZTIjHL/DuEk+aVIlsnehac1AVuHPqGsWd1G3iM1QkUjNUf2VARczS9IvWybk34JUvaN2Nrrbgzcg0rXqFOPXcgtNQ/N1CdsNurjCHfPts71oxXVKMMlmJqWPyKCjba5MR/yGgt4dZk1+tBnZdHRIyFY///qHQOnVva0W2Xvz0nER8bmarcRIYHjZ17HI34umymQKyK0khM3a1gKctL1Qo2xBBzbZHPGxByR+gisC7R9B1+ceOVeyAS5cjsdoFK8mJTB/48KKekzyHP6LJq5VV8Wi55rllA4AoWY1TM4LNnwrs26qQR9yP/waFVvgxfw+nNpovEUj86OrF8/hB16b6b5vdGcJQlyFM0BGdy3Yeof/xuiHAxkzh+LIqLS5oHTPxBACsF7/pXMUTKewW8OgTuNo1AHqa2bTIXRPBBPvqI4RfWQTjYo1g4IYApr3zEA9Fg0rOBbFgOUo58bdXTP4gY2n3WzMoWqOXUSvwICT5RF94Td/F6JiNlQaQrY3U98TTEgYjgi3zGaAvOWru2fNsZvIkVbY64FMq9pA0X3TJGn6gtBH0guf5tAkyixOp7mOyuF2vL8D1QHg5rJINd2UvwupXR+xqb2piVaTxXsJgz9Y8UzClkcAXcYVCPEZU9XWgxmnj1B3l4P+A=----ATTACHMENT:----NDM0NjEyNjA0NTE4ODM1NSAxMTI1NTgzMTg0NjE2MTA1IDk3MTA2NzYxNjQyMTEyNzM=