vendor/shopware/platform/src/Storefront/Storefront.php line 21

Open in your IDE?
  1. <?php declare(strict_types=1);
  2. namespace Shopware\Storefront;
  3. use Shopware\Core\Framework\Bundle;
  4. use Shopware\Core\Kernel;
  5. use Shopware\Storefront\DependencyInjection\DisableTemplateCachePass;
  6. use Shopware\Storefront\Framework\ThemeInterface;
  7. use Symfony\Component\Config\FileLocator;
  8. use Symfony\Component\Config\Loader\DelegatingLoader;
  9. use Symfony\Component\Config\Loader\LoaderResolver;
  10. use Symfony\Component\DependencyInjection\ContainerBuilder;
  11. use Symfony\Component\DependencyInjection\Loader\ClosureLoader;
  12. use Symfony\Component\DependencyInjection\Loader\DirectoryLoader;
  13. use Symfony\Component\DependencyInjection\Loader\GlobFileLoader;
  14. use Symfony\Component\DependencyInjection\Loader\IniFileLoader;
  15. use Symfony\Component\DependencyInjection\Loader\PhpFileLoader;
  16. use Symfony\Component\DependencyInjection\Loader\XmlFileLoader;
  17. use Symfony\Component\DependencyInjection\Loader\YamlFileLoader;
  18. class Storefront extends Bundle implements ThemeInterface
  19. {
  20.     protected $name 'Storefront';
  21.     /**
  22.      * {@inheritdoc}
  23.      */
  24.     public function build(ContainerBuilder $container): void
  25.     {
  26.         parent::build($container);
  27.         $loader = new XmlFileLoader($container, new FileLocator(__DIR__ '/DependencyInjection'));
  28.         $loader->load('services.xml');
  29.         $loader->load('seo.xml');
  30.         $loader->load('controller.xml');
  31.         $loader->load('theme.xml');
  32.         $environment $container->getParameter('kernel.environment');
  33.         $this->buildConfig($container$environment);
  34.         $container->setParameter('storefrontRoot'$this->getPath());
  35.         $container->addCompilerPass(new DisableTemplateCachePass());
  36.         $this->addCoreMigrationPath($container$this->getMigrationPath(), $this->getMigrationNamespace());
  37.     }
  38.     private function buildConfig(ContainerBuilder $container$environment): void
  39.     {
  40.         $locator = new FileLocator('Resources/config');
  41.         $resolver = new LoaderResolver([
  42.             new XmlFileLoader($container$locator),
  43.             new YamlFileLoader($container$locator),
  44.             new IniFileLoader($container$locator),
  45.             new PhpFileLoader($container$locator),
  46.             new GlobFileLoader($container$locator),
  47.             new DirectoryLoader($container$locator),
  48.             new ClosureLoader($container),
  49.         ]);
  50.         $configLoader = new DelegatingLoader($resolver);
  51.         $confDir $this->getPath() . '/Resources/config';
  52.         $configLoader->load($confDir '/{packages}/*' Kernel::CONFIG_EXTS'glob');
  53.         $configLoader->load($confDir '/{packages}/' $environment '/*' Kernel::CONFIG_EXTS'glob');
  54.     }
  55. }