vendor/contao-community-alliance/event-dispatcher/src/CcaEventDispatcherBundle.php line 29

Open in your IDE?
  1. <?php
  2. /**
  3.  * This file is part of contao-community-alliance/event-dispatcher.
  4.  *
  5.  * (c) 2013-2016 Contao Community Alliance <https://c-c-a.org>
  6.  *
  7.  * This project is provided in good faith and hope to be usable by anyone.
  8.  *
  9.  * @package    contao-community-alliance/event-dispatcher
  10.  * @author     Christian Schiffler <c.schiffler@cyberspectrum.de>
  11.  * @copyright  2013-2016 Contao Community Alliance <https://c-c-a.org>
  12.  * @license    https://github.com/contao-community-alliance/event-dispatcher/LICENSE LGPL-3.0+
  13.  * @link       https://github.com/contao-community-alliance/event-dispatcher
  14.  * @filesource
  15.  */
  16. namespace ContaoCommunityAlliance\Contao\EventDispatcher;
  17. use ContaoCommunityAlliance\Contao\EventDispatcher\Configuration\ResourceLocator;
  18. use ContaoCommunityAlliance\Contao\EventDispatcher\DependencyInjection\Compiler\AddConfiguratorPass;
  19. use Symfony\Component\DependencyInjection\Compiler\PassConfig;
  20. use Symfony\Component\DependencyInjection\ContainerBuilder;
  21. use Symfony\Component\HttpKernel\Bundle\Bundle;
  22. /**
  23.  * This is the bundle for the legacy event dispatcher.
  24.  */
  25. class CcaEventDispatcherBundle extends Bundle
  26. {
  27.     /**
  28.      * {@inheritDoc}
  29.      */
  30.     public function build(ContainerBuilder $container)
  31.     {
  32.         parent::build($container);
  33.         $rootDir dirname($container->getParameter('kernel.root_dir'));
  34.         $bundles $container->getParameter('kernel.bundles');
  35.         // We can not modify an compiled container.
  36.         if (!$container->isCompiled()) {
  37.             $listenerLocator = new ResourceLocator($rootDir$bundles'event_listeners.php');
  38.             $container->setParameter(
  39.                 'cca.event_dispatcher.legacy_listeners',
  40.                 $listenerLocator->getResourcePaths()
  41.             );
  42.             $subscriberLocator = new ResourceLocator($rootDir$bundles'event_subscribers.php');
  43.             $container->setParameter(
  44.                 'cca.event_dispatcher.legacy_subscribers',
  45.                 $subscriberLocator->getResourcePaths()
  46.             );
  47.         }
  48.         $container->addCompilerPass(new AddConfiguratorPass(), PassConfig::TYPE_BEFORE_OPTIMIZATION);
  49.     }
  50. }