vendor/sylius/sylius/src/Sylius/Bundle/CoreBundle/SyliusCoreBundle.php line 37

Open in your IDE?
  1. <?php
  2. /*
  3.  * This file is part of the Sylius package.
  4.  *
  5.  * (c) Paweł Jędrzejewski
  6.  *
  7.  * For the full copyright and license information, please view the LICENSE
  8.  * file that was distributed with this source code.
  9.  */
  10. declare(strict_types=1);
  11. namespace Sylius\Bundle\CoreBundle;
  12. use Doctrine\Inflector\InflectorFactory;
  13. use Doctrine\Inflector\Rules\Patterns;
  14. use Doctrine\Inflector\Rules\Ruleset;
  15. use Doctrine\Inflector\Rules\Substitution;
  16. use Doctrine\Inflector\Rules\Substitutions;
  17. use Doctrine\Inflector\Rules\Transformations;
  18. use Doctrine\Inflector\Rules\Word;
  19. use Sylius\Bundle\CoreBundle\DependencyInjection\Compiler\BackwardsCompatibility\ResolveShopUserTargetEntityPass;
  20. use Sylius\Bundle\CoreBundle\DependencyInjection\Compiler\CircularDependencyBreakingErrorListenerPass;
  21. use Sylius\Bundle\CoreBundle\DependencyInjection\Compiler\CircularDependencyBreakingExceptionListenerPass;
  22. use Sylius\Bundle\CoreBundle\DependencyInjection\Compiler\IgnoreAnnotationsPass;
  23. use Sylius\Bundle\CoreBundle\DependencyInjection\Compiler\LazyCacheWarmupPass;
  24. use Sylius\Bundle\CoreBundle\DependencyInjection\Compiler\LiipImageFiltersPass;
  25. use Sylius\Bundle\CoreBundle\DependencyInjection\Compiler\RegisterTaxCalculationStrategiesPass;
  26. use Sylius\Bundle\CoreBundle\DependencyInjection\Compiler\RegisterUriBasedSectionResolverPass;
  27. use Sylius\Bundle\CoreBundle\DependencyInjection\Compiler\TranslatableEntityLocalePass;
  28. use Sylius\Bundle\ResourceBundle\AbstractResourceBundle;
  29. use Sylius\Bundle\ResourceBundle\SyliusResourceBundle;
  30. use Sylius\Component\Resource\Metadata\Metadata;
  31. use Symfony\Component\DependencyInjection\ContainerBuilder;
  32. final class SyliusCoreBundle extends AbstractResourceBundle
  33. {
  34.     public function getSupportedDrivers(): array
  35.     {
  36.         return [
  37.             SyliusResourceBundle::DRIVER_DOCTRINE_ORM,
  38.         ];
  39.     }
  40.     public function boot(): void
  41.     {
  42.         parent::boot();
  43.         $factory InflectorFactory::create();
  44.         $factory->withPluralRules(new Ruleset(
  45.             new Transformations(),
  46.             new Patterns(),
  47.             new Substitutions(new Substitution(new Word('taxon'), new Word('taxons')))
  48.         ));
  49.         $inflector $factory->build();
  50.         Metadata::setInflector($inflector);
  51.     }
  52.     public function build(ContainerBuilder $container): void
  53.     {
  54.         parent::build($container);
  55.         $container->addCompilerPass(new CircularDependencyBreakingErrorListenerPass());
  56.         $container->addCompilerPass(new CircularDependencyBreakingExceptionListenerPass());
  57.         $container->addCompilerPass(new LazyCacheWarmupPass());
  58.         $container->addCompilerPass(new RegisterTaxCalculationStrategiesPass());
  59.         $container->addCompilerPass(new TranslatableEntityLocalePass());
  60.         $container->addCompilerPass(new IgnoreAnnotationsPass());
  61.         $container->addCompilerPass(new ResolveShopUserTargetEntityPass());
  62.         $container->addCompilerPass(new RegisterUriBasedSectionResolverPass());
  63.         $container->addCompilerPass(new LiipImageFiltersPass());
  64.     }
  65.     /**
  66.      * @psalm-suppress MismatchingDocblockReturnType https://github.com/vimeo/psalm/issues/2345
  67.      */
  68.     protected function getModelNamespace(): string
  69.     {
  70.         return 'Sylius\Component\Core\Model';
  71.     }
  72. }