vendor/coreshop/resource-bundle/CoreShopResourceBundle.php line 31

Open in your IDE?
  1. <?php
  2. /**
  3.  * CoreShop.
  4.  *
  5.  * This source file is subject to the GNU General Public License version 3 (GPLv3)
  6.  * For the full copyright and license information, please view the LICENSE.md and gpl-3.0.txt
  7.  * files that are distributed with this source code.
  8.  *
  9.  * @copyright  Copyright (c) 2015-2020 Dominik Pfaffenbauer (https://www.pfaffenbauer.at)
  10.  * @license    https://www.coreshop.org/license     GNU General Public License version 3 (GPLv3)
  11.  */
  12. namespace CoreShop\Bundle\ResourceBundle;
  13. use CoreShop\Bundle\ResourceBundle\DependencyInjection\Compiler\DoctrineTargetEntitiesResolverPass;
  14. use CoreShop\Bundle\ResourceBundle\DependencyInjection\Compiler\RegisterInstallersPass;
  15. use CoreShop\Bundle\ResourceBundle\DependencyInjection\Compiler\RegisterPimcoreRepositoriesPass;
  16. use CoreShop\Bundle\ResourceBundle\DependencyInjection\Compiler\RegisterPimcoreResourcesPass;
  17. use CoreShop\Bundle\ResourceBundle\DependencyInjection\Compiler\RegisterResourcesPass;
  18. use CoreShop\Bundle\ResourceBundle\DependencyInjection\Compiler\StackClassesPass;
  19. use CoreShop\Bundle\ResourceBundle\DependencyInjection\Compiler\StackRepositoryPass;
  20. use CoreShop\Bundle\ResourceBundle\DependencyInjection\Compiler\ValidatorAutoMappingFixPass;
  21. use JMS\SerializerBundle\JMSSerializerBundle;
  22. use PackageVersions\Versions;
  23. use Pimcore\Extension\Bundle\AbstractPimcoreBundle;
  24. use Pimcore\Extension\Bundle\Traits\PackageVersionTrait;
  25. use Pimcore\HttpKernel\BundleCollection\BundleCollection;
  26. use Pimcore\HttpKernel\Bundle\DependentBundleInterface;
  27. use Symfony\Component\DependencyInjection\ContainerBuilder;
  28. final class CoreShopResourceBundle extends AbstractPimcoreBundle implements DependentBundleInterface
  29. {
  30.     use PackageVersionTrait;
  31.     const DRIVER_DOCTRINE_ORM 'doctrine/orm';
  32.     const DRIVER_PIMCORE 'pimcore';
  33.     const PIMCORE_MODEL_TYPE_OBJECT 'object';
  34.     const PIMCORE_MODEL_TYPE_FIELD_COLLECTION 'fieldcollection';
  35.     const PIMCORE_MODEL_TYPE_BRICK 'brick';
  36.     /**
  37.      * {@inheritdoc}
  38.      */
  39.     public function build(ContainerBuilder $container)
  40.     {
  41.         parent::build($container);
  42.         $container->addCompilerPass(new RegisterResourcesPass());
  43.         $container->addCompilerPass(new RegisterPimcoreResourcesPass());
  44.         $container->addCompilerPass(new DoctrineTargetEntitiesResolverPass());
  45.         $container->addCompilerPass(new RegisterInstallersPass());
  46.         $container->addCompilerPass(new StackClassesPass());
  47.         $container->addCompilerPass(new StackRepositoryPass());
  48.         $container->addCompilerPass(new RegisterPimcoreRepositoriesPass());
  49.         $container->addCompilerPass(new ValidatorAutoMappingFixPass());
  50.     }
  51.     /**
  52.      * {@inheritdoc}
  53.      */
  54.     public static function registerDependentBundles(BundleCollection $collection)
  55.     {
  56.         $collection->addBundle(new JMSSerializerBundle(), 3900);
  57.         $collection->addBundle(new \CoreShop\Bundle\PimcoreBundle\CoreShopPimcoreBundle(), 3850);
  58.         $collection->addBundle(new \Doctrine\Bundle\DoctrineCacheBundle\DoctrineCacheBundle(), 1400);
  59.         $collection->addBundle(new \Stof\DoctrineExtensionsBundle\StofDoctrineExtensionsBundle(), 1200);
  60.     }
  61.     /**
  62.      * @return string
  63.      */
  64.     public function getNiceName()
  65.     {
  66.         return 'CoreShop - Resource';
  67.     }
  68.     /**
  69.      * @return string
  70.      */
  71.     public function getDescription()
  72.     {
  73.         return 'CoreShop - Resource Bundle';
  74.     }
  75.     /**
  76.      * @return string
  77.      */
  78.     public function getComposerPackageName()
  79.     {
  80.         if (isset(Versions::VERSIONS['coreshop/resource-bundle'])) {
  81.             return 'coreshop/resource-bundle';
  82.         }
  83.         return 'coreshop/core-shop';
  84.     }
  85.     /**
  86.      * @return string[]
  87.      */
  88.     public static function getAvailableDrivers()
  89.     {
  90.         return [
  91.             self::DRIVER_DOCTRINE_ORM,
  92.         ];
  93.     }
  94. }