vendor/symfony-cmf/routing-auto-bundle/src/CmfRoutingAutoBundle.php line 20

Open in your IDE?
  1. <?php
  2. /*
  3.  * This file is part of the Symfony CMF package.
  4.  *
  5.  * (c) 2011-2015 Symfony CMF
  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\Cmf\Bundle\RoutingAutoBundle;
  11. use Symfony\Component\HttpKernel\Bundle\Bundle;
  12. use Symfony\Component\DependencyInjection\ContainerBuilder;
  13. use Doctrine\Bundle\PHPCRBundle\DependencyInjection\Compiler\DoctrinePhpcrMappingsPass;
  14. use Symfony\Cmf\Bundle\RoutingAutoBundle\DependencyInjection\Compiler\ServicePass;
  15. use Symfony\Cmf\Bundle\RoutingAutoBundle\DependencyInjection\Compiler\AdapterPass;
  16. class CmfRoutingAutoBundle extends Bundle
  17. {
  18.     public function build(ContainerBuilder $container)
  19.     {
  20.         parent::build($container);
  21.         $container->addCompilerPass(new ServicePass());
  22.         $container->addCompilerPass(new AdapterPass());
  23.         $this->buildPhpcrCompilerPass($container);
  24.     }
  25.     /**
  26.      * Creates and registers compiler passes for PHPCR-ODM mapping if both the
  27.      * phpcr-odm and the phpcr-bundle are present.
  28.      *
  29.      * @param ContainerBuilder $container
  30.      */
  31.     private function buildPhpcrCompilerPass(ContainerBuilder $container)
  32.     {
  33.         if (!class_exists('Doctrine\Bundle\PHPCRBundle\DependencyInjection\Compiler\DoctrinePhpcrMappingsPass')
  34.             || !class_exists('Doctrine\ODM\PHPCR\Version')
  35.         ) {
  36.             return;
  37.         }
  38.         $bundles $container->getParameter('kernel.bundles');
  39.         if (isset($bundles['CmfRoutingBundle'])) {
  40.             $container->addCompilerPass(
  41.                 DoctrinePhpcrMappingsPass::createXmlMappingDriver(
  42.                     array(
  43.                         realpath(__DIR__.'/Resources/config/doctrine-model') => 'Symfony\Cmf\Bundle\RoutingAutoBundle\Model',
  44.                     ),
  45.                     array('cmf_routing_auto.persistence.phpcr.manager_name'),
  46.                     false,
  47.                     array('CmfRoutingAutoBundle' => 'Symfony\Cmf\Bundle\RoutingAutoBundle\Model')
  48.                 )
  49.             );
  50.         }
  51.     }
  52. }