src/Kernel.php line 20

Open in your IDE?
  1. <?php
  2. namespace App;
  3. use Pimcore\HttpKernel\BundleCollection\BundleCollection;
  4. use Pimcore\Kernel as PimcoreKernel;
  5. class Kernel extends PimcoreKernel
  6. {
  7.     /**
  8.      * Symfony's Kernel::handle() runs preBoot() -> initializeBundles() ->
  9.      * registerBundles() before boot() ever runs. registerBundles() reaches
  10.      * registerExtensionManagerBundles(), which needs both the
  11.      * PIMCORE_CUSTOM_CONFIGURATION_DIRECTORY-family constants and
  12.      * $this->extensionConfig — both of which PimcoreKernel::boot() sets up,
  13.      * but boot() hasn't run yet at this point. Bootstrap::defineConstants()
  14.      * is idempotent (checks defined() before defining), so it's safe to
  15.      * call here even though boot() calls it again later.
  16.      */
  17.     public function registerBundles(): array
  18.     {
  19.         \Pimcore\Bootstrap::defineConstants();
  20.         if ($this->extensionConfig === null) {
  21.             $this->extensionConfig = new \Pimcore\Extension\Config();
  22.         }
  23.         return parent::registerBundles();
  24.     }
  25.     /**
  26.      * Adds bundles to register to the bundle collection. The collection is able
  27.      * to handle priorities and environment specific bundles.
  28.      */
  29.     public function registerBundlesToCollection(BundleCollection $collection): void
  30.     {
  31.         // None of these are auto-registered by PimcoreKernel. Each one is
  32.         // declared as a "pimcore-bundle" in its own composer.json
  33.         // (extra.pimcore.bundles) but that's just metadata - Pimcore has
  34.         // no auto-discovery that reads it, the project Kernel still has
  35.         // to register it explicitly. These registrations must have lived
  36.         // in app/AppKernel.php and were dropped when it was replaced by
  37.         // this file during the Pimcore 6->10 migration.
  38.         $collection->addBundle(new \Pimcore\Bundle\EcommerceFrameworkBundle\PimcoreEcommerceFrameworkBundle());
  39.         $collection->addBundle(new \CustomerManagementFrameworkBundle\PimcoreCustomerManagementFrameworkBundle());
  40.         $collection->addBundle(new \Pimcore\Bundle\DataHubBundle\PimcoreDataHubBundle());
  41.         // Replaces the CSV import that Pimcore 10 removed from core (the old
  42.         // tree "CSV Import" menu called pimcore.object.helpers.import.configDialog,
  43.         // which no longer exists). Registered after DataHubBundle because the
  44.         // importer plugs into Datahub. Configurations live in admin -> Datahub.
  45.         $collection->addBundle(new \Pimcore\Bundle\DataImporterBundle\PimcoreDataImporterBundle());
  46.         $collection->addBundle(new \Pimcore\Bundle\NumberSequenceGeneratorBundle\NumberSequenceGeneratorBundle());
  47.         $collection->addBundle(new \Pimcore\Bundle\ObjectMergerBundle\ObjectMergerBundle());
  48.         if (class_exists('\\AppBundle\\AppBundle')) {
  49.             $collection->addBundle(new \AppBundle\AppBundle);
  50.         }
  51.         // Registered ahead of GlobalBundle on purpose: routes load in bundle
  52.         // registration order, and GlobalBundle's "landing" route (@Route("/")
  53.         // with no host constraint) otherwise captures "/" on every domain -
  54.         // including inspectright.local - before this bundle's own host-scoped
  55.         // root route can match. See InspectRightBundle/.../pimcore/routing.yml.
  56.         if (class_exists('\\InspectRightBundle\\InspectRightBundle')) {
  57.             $collection->addBundle(new \InspectRightBundle\InspectRightBundle);
  58.         }
  59.         if (class_exists('\\GlobalBundle\\GlobalBundle')) {
  60.             $collection->addBundle(new \GlobalBundle\GlobalBundle);
  61.         }
  62.         if (class_exists('\\WebsiteBundle\\WebsiteBundle')) {
  63.             $collection->addBundle(new \WebsiteBundle\WebsiteBundle);
  64.         }
  65.     }
  66. }