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

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) CoreShop GmbH (https://www.coreshop.org)
  10.  * @license    https://www.coreshop.org/license     GNU General Public License version 3 (GPLv3)
  11.  */
  12. declare(strict_types=1);
  13. namespace CoreShop\Bundle\ResourceBundle;
  14. use Composer\InstalledVersions;
  15. use CoreShop\Bundle\CoreBundle\Application\Version;
  16. use CoreShop\Bundle\ResourceBundle\DependencyInjection\Compiler\DoctrineTargetEntitiesResolverPass;
  17. use CoreShop\Bundle\ResourceBundle\DependencyInjection\Compiler\RegisterInstallersPass;
  18. use CoreShop\Bundle\ResourceBundle\DependencyInjection\Compiler\RegisterPimcoreRepositoriesPass;
  19. use CoreShop\Bundle\ResourceBundle\DependencyInjection\Compiler\RegisterPimcoreResourcesPass;
  20. use CoreShop\Bundle\ResourceBundle\DependencyInjection\Compiler\RegisterResourcesPass;
  21. use CoreShop\Bundle\ResourceBundle\DependencyInjection\Compiler\StackClassesPass;
  22. use CoreShop\Bundle\ResourceBundle\DependencyInjection\Compiler\StackRepositoryPass;
  23. use CoreShop\Bundle\ResourceBundle\DependencyInjection\Compiler\ValidatorAutoMappingFixPass;
  24. use JMS\SerializerBundle\JMSSerializerBundle;
  25. use Pimcore\Extension\Bundle\AbstractPimcoreBundle;
  26. use Pimcore\HttpKernel\Bundle\DependentBundleInterface;
  27. use Pimcore\HttpKernel\BundleCollection\BundleCollection;
  28. use Symfony\Component\DependencyInjection\ContainerBuilder;
  29. final class CoreShopResourceBundle extends AbstractPimcoreBundle implements DependentBundleInterface
  30. {
  31.     public const DRIVER_DOCTRINE_ORM 'doctrine/orm';
  32.     public const DRIVER_PIMCORE 'pimcore';
  33.     public const PIMCORE_MODEL_TYPE_OBJECT 'object';
  34.     public const PIMCORE_MODEL_TYPE_FIELD_COLLECTION 'fieldcollection';
  35.     public const PIMCORE_MODEL_TYPE_BRICK 'brick';
  36.     public function build(ContainerBuilder $container): void
  37.     {
  38.         parent::build($container);
  39.         $container->addCompilerPass(new RegisterResourcesPass());
  40.         $container->addCompilerPass(new RegisterPimcoreResourcesPass());
  41.         $container->addCompilerPass(new DoctrineTargetEntitiesResolverPass());
  42.         $container->addCompilerPass(new RegisterInstallersPass());
  43.         $container->addCompilerPass(new StackClassesPass());
  44.         $container->addCompilerPass(new StackRepositoryPass());
  45.         $container->addCompilerPass(new RegisterPimcoreRepositoriesPass());
  46.         $container->addCompilerPass(new ValidatorAutoMappingFixPass());
  47.     }
  48.     public static function registerDependentBundles(BundleCollection $collection): void
  49.     {
  50.         $collection->addBundle(new JMSSerializerBundle(), 3900);
  51.         $collection->addBundle(new \CoreShop\Bundle\PimcoreBundle\CoreShopPimcoreBundle(), 3850);
  52.         $collection->addBundle(new \CoreShop\Bundle\OptimisticEntityLockBundle\CoreShopOptimisticEntityLockBundle(), 3800);
  53.         $collection->addBundle(new \CoreShop\Bundle\LocaleBundle\CoreShopLocaleBundle(), 3850);
  54.         $collection->addBundle(new \Stof\DoctrineExtensionsBundle\StofDoctrineExtensionsBundle(), 1200);
  55.     }
  56.     public function getNiceName(): string
  57.     {
  58.         return 'CoreShop - Resource';
  59.     }
  60.     public function getDescription(): string
  61.     {
  62.         return 'CoreShop - Resource Bundle';
  63.     }
  64.     public function getVersion(): string
  65.     {
  66.         $bundleName 'coreshop/pimcore-bundle';
  67.         if (class_exists(InstalledVersions::class)) {
  68.             if (InstalledVersions::isInstalled('coreshop/core-shop')) {
  69.                 return InstalledVersions::getVersion('coreshop/core-shop');
  70.             }
  71.             if (InstalledVersions::isInstalled($bundleName)) {
  72.                 return InstalledVersions::getVersion($bundleName);
  73.             }
  74.         }
  75.         if (class_exists(Version::class)) {
  76.             return Version::getVersion();
  77.         }
  78.         return '';
  79.     }
  80.     public static function getAvailableDrivers(): array
  81.     {
  82.         return [
  83.             self::DRIVER_DOCTRINE_ORM,
  84.         ];
  85.     }
  86. }