123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354 |
- <?php
-
-
-
- namespace FOS\UserBundle\DependencyInjection\Compiler;
-
- use Symfony\Component\DependencyInjection\ContainerBuilder;
- use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
- use Symfony\Component\Config\Resource\FileResource;
-
-
- class ValidationPass implements CompilerPassInterface
- {
-
-
- public function process(ContainerBuilder $container)
- {
- if (!$container->hasParameter('fos_user.storage')) {
- return;
- }
-
- $storage = $container->getParameter('fos_user.storage');
- if ('custom' === $storage) {
- return;
- }
-
- if (!$container->hasParameter('validator.mapping.loader.xml_files_loader.mapping_files')) {
- return;
- }
-
- $files = $container->getParameter('validator.mapping.loader.xml_files_loader.mapping_files');
- $validationFile = __DIR__ . '/../../Resources/config/validation/' . $storage . '.xml';
-
- if (is_file($validationFile)) {
- $files[] = realpath($validationFile);
- $container->addResource(new FileResource($validationFile));
- }
-
- $container->setParameter('validator.mapping.loader.xml_files_loader.mapping_files', $files);
- }
- }
|