Files
Chamilo/vendor/friendsofsymfony/user-bundle/DependencyInjection/Compiler/ValidationPass.php
2025-08-14 22:41:49 +02:00

45 lines
1.2 KiB
PHP

<?php
/*
* This file is part of the FOSUserBundle package.
*
* (c) FriendsOfSymfony <http://friendsofsymfony.github.com/>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace FOS\UserBundle\DependencyInjection\Compiler;
use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
use Symfony\Component\DependencyInjection\ContainerBuilder;
/**
* Registers the additional validators according to the storage.
*
* @author Christophe Coevoet <stof@notk.org>
*/
class ValidationPass implements CompilerPassInterface
{
/**
* {@inheritdoc}
*/
public function process(ContainerBuilder $container)
{
if (!$container->hasParameter('fos_user.storage')) {
return;
}
$storage = $container->getParameter('fos_user.storage');
if ('custom' === $storage) {
return;
}
$validationFile = __DIR__.'/../../Resources/config/storage-validation/'.$storage.'.xml';
$container->getDefinition('validator.builder')
->addMethodCall('addXmlMapping', array($validationFile));
}
}