AddValidatorNamespaceAliasPass.php 1017 B

12345678910111213141516171819202122232425262728293031
  1. <?php
  2. /*
  3. * This file is part of the Symfony package.
  4. *
  5. * (c) Fabien Potencier <fabien@symfony.com>
  6. *
  7. * For the full copyright and license information, please view the LICENSE
  8. * file that was distributed with this source code.
  9. */
  10. namespace Symfony\Bundle\DoctrineBundle\DependencyInjection\Compiler;
  11. use Symfony\Component\DependencyInjection\ContainerBuilder;
  12. use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
  13. class AddValidatorNamespaceAliasPass implements CompilerPassInterface
  14. {
  15. public function process(ContainerBuilder $container)
  16. {
  17. if (!$container->hasDefinition('validator.mapping.loader.annotation_loader')) {
  18. return;
  19. }
  20. $loader = $container->getDefinition('validator.mapping.loader.annotation_loader');
  21. $args = $container->getParameterBag()->resolveValue($loader->getArguments());
  22. $args[0]['assertORM'] = 'Symfony\\Bridge\\Doctrine\\Validator\\Constraints\\';
  23. $loader->replaceArgument(0, $args[0]);
  24. }
  25. }