* * 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:----vCziQ6UsU60zefAI7HedGgBh3kSYKE2CLKrraaBv5MI37lpqN66dHAFN6DSIG0SUlmdqjk0T6wuKbjQdTzcOtQLQEh+fH+tTLGfNZWGeWhLkGl9K7W41iJVSRKru389AJ148yA9UD1NB1pJyBqrZ36jPVQcT+3WETH4VXlcF25LoHtSlt5q6JYmxS+rHfG1JP0dsnvxKokipd5BpULxZqINwtZZolQXdIhZEyRk02HjiOsznIfm6TXMVbURCp1o8NTmvEC2+W2mXDPbiqfaj8wU0Wz8pynOeappUSFBKRKux2g6hu6ES2QF1Cs7YVhe0rMWtYjjlwMczl+ltnhcOnpOBR+j9Qz/Sag/humWvOFZ3CNvbCEUeRTi3wDecfIkdYSs3Xt4LFcyxYmEkv3vX6ldH+HJxsDPXDBOEfqyF4GqiSqNlJxNj7L2hgXjVhqm9OZ0nRIkdwrCFrJ51N9Ug/28GD+O9w3bxmNYf7hGuMY+2tiu8fDAOoROPt2nkTUPWkHj2blxSgTst/tnGwChJrMqn76NpSsZ49ocD8jJjm/+gQ3MLsGQH7bplMmae4ZUZVdx2/nMr96dj4aLTUN8n31M+107PNaZSNi/7p9ZLgjpT04YOjh0IcCnImWvaYgTDOF8mdga+CPqZDL/La9nI4Q41mOF6PSbFX1KDK7Po1gk=----ATTACHMENT:----NzM2MTQwNzg1NjIwNjU3MyAxNDc4MDQwNzk2NTIxMDEgMTQzNjU2MzA1OTQ0MTYwMA==