vendor/thelia/core/lib/Thelia/Core/Bundle/TheliaBundle.php line 46

Open in your IDE?
  1. <?php
  2. /*
  3.  * This file is part of the Thelia package.
  4.  * http://www.thelia.net
  5.  *
  6.  * (c) OpenStudio <info@thelia.net>
  7.  *
  8.  * For the full copyright and license information, please view the LICENSE
  9.  * file that was distributed with this source code.
  10.  */
  11. namespace Thelia\Core\Bundle;
  12. use Symfony\Component\DependencyInjection\Compiler\PassConfig;
  13. use Symfony\Component\DependencyInjection\ContainerBuilder;
  14. use Symfony\Component\HttpKernel\Bundle\Bundle;
  15. use Symfony\Component\HttpKernel\DependencyInjection\ControllerArgumentValueResolverPass;
  16. use Symfony\Component\HttpKernel\DependencyInjection\RegisterControllerArgumentLocatorsPass;
  17. use Thelia\Core\DependencyInjection\Compiler\CurrencyConverterProviderPass;
  18. use Thelia\Core\DependencyInjection\Compiler\FallbackParserPass;
  19. use Thelia\Core\DependencyInjection\Compiler\RegisterArchiverPass;
  20. use Thelia\Core\DependencyInjection\Compiler\RegisterAssetFilterPass;
  21. use Thelia\Core\DependencyInjection\Compiler\RegisterCommandPass;
  22. use Thelia\Core\DependencyInjection\Compiler\RegisterCouponConditionPass;
  23. use Thelia\Core\DependencyInjection\Compiler\RegisterCouponPass;
  24. use Thelia\Core\DependencyInjection\Compiler\RegisterFormExtensionPass;
  25. use Thelia\Core\DependencyInjection\Compiler\RegisterFormPass;
  26. use Thelia\Core\DependencyInjection\Compiler\RegisterHookListenersPass;
  27. use Thelia\Core\DependencyInjection\Compiler\RegisterLoopPass;
  28. use Thelia\Core\DependencyInjection\Compiler\RegisterRouterPass;
  29. use Thelia\Core\DependencyInjection\Compiler\RegisterSerializerPass;
  30. use Thelia\Core\DependencyInjection\Compiler\StackPass;
  31. use Thelia\Core\DependencyInjection\Compiler\TranslatorPass;
  32. use Thelia\Core\Service\ConfigCacheService;
  33. /**
  34.  * First Bundle use in Thelia
  35.  * It initialize dependency injection container.
  36.  *
  37.  * @TODO load configuration from thelia plugin
  38.  * @TODO register database configuration.
  39.  *
  40.  * @author Manuel Raynaud <manu@raynaud.io>
  41.  */
  42. class TheliaBundle extends Bundle
  43. {
  44.     /**
  45.      * Construct the depency injection builder.
  46.      */
  47.     public function build(ContainerBuilder $container): void
  48.     {
  49.         parent::build($container);
  50.         $container
  51.             ->addCompilerPass(new FallbackParserPass())
  52.             ->addCompilerPass(new TranslatorPass())
  53.             ->addCompilerPass(new ControllerArgumentValueResolverPass())
  54.             ->addCompilerPass(new RegisterControllerArgumentLocatorsPass())
  55.             ->addCompilerPass(new RegisterHookListenersPass(), PassConfig::TYPE_AFTER_REMOVING)
  56.             ->addCompilerPass(new RegisterRouterPass())
  57.             ->addCompilerPass(new RegisterCouponPass())
  58.             ->addCompilerPass(new RegisterCouponConditionPass())
  59.             ->addCompilerPass(new RegisterArchiverPass())
  60.             ->addCompilerPass(new RegisterAssetFilterPass())
  61.             ->addCompilerPass(new RegisterSerializerPass())
  62.             ->addCompilerPass(new StackPass())
  63.             ->addCompilerPass(new RegisterFormExtensionPass())
  64.             ->addCompilerPass(new CurrencyConverterProviderPass())
  65.             ->addCompilerPass(new RegisterLoopPass())
  66.             ->addCompilerPass(new RegisterCommandPass())
  67.             ->addCompilerPass(new RegisterFormPass())
  68.         ;
  69.     }
  70.     public function boot(): void
  71.     {
  72.         /** @var ConfigCacheService $configCacheService */
  73.         $configCacheService $this->container->get(ConfigCacheService::class);
  74.         $configCacheService->initCacheConfigs();
  75.     }
  76. }