<?php
namespace App;
use Pimcore\HttpKernel\BundleCollection\BundleCollection;
use Pimcore\Kernel as PimcoreKernel;
class Kernel extends PimcoreKernel
{
/**
* Symfony's Kernel::handle() runs preBoot() -> initializeBundles() ->
* registerBundles() before boot() ever runs. registerBundles() reaches
* registerExtensionManagerBundles(), which needs both the
* PIMCORE_CUSTOM_CONFIGURATION_DIRECTORY-family constants and
* $this->extensionConfig — both of which PimcoreKernel::boot() sets up,
* but boot() hasn't run yet at this point. Bootstrap::defineConstants()
* is idempotent (checks defined() before defining), so it's safe to
* call here even though boot() calls it again later.
*/
public function registerBundles(): array
{
\Pimcore\Bootstrap::defineConstants();
if ($this->extensionConfig === null) {
$this->extensionConfig = new \Pimcore\Extension\Config();
}
return parent::registerBundles();
}
/**
* Adds bundles to register to the bundle collection. The collection is able
* to handle priorities and environment specific bundles.
*/
public function registerBundlesToCollection(BundleCollection $collection): void
{
// None of these are auto-registered by PimcoreKernel. Each one is
// declared as a "pimcore-bundle" in its own composer.json
// (extra.pimcore.bundles) but that's just metadata - Pimcore has
// no auto-discovery that reads it, the project Kernel still has
// to register it explicitly. These registrations must have lived
// in app/AppKernel.php and were dropped when it was replaced by
// this file during the Pimcore 6->10 migration.
$collection->addBundle(new \Pimcore\Bundle\EcommerceFrameworkBundle\PimcoreEcommerceFrameworkBundle());
$collection->addBundle(new \CustomerManagementFrameworkBundle\PimcoreCustomerManagementFrameworkBundle());
$collection->addBundle(new \Pimcore\Bundle\DataHubBundle\PimcoreDataHubBundle());
// Replaces the CSV import that Pimcore 10 removed from core (the old
// tree "CSV Import" menu called pimcore.object.helpers.import.configDialog,
// which no longer exists). Registered after DataHubBundle because the
// importer plugs into Datahub. Configurations live in admin -> Datahub.
$collection->addBundle(new \Pimcore\Bundle\DataImporterBundle\PimcoreDataImporterBundle());
$collection->addBundle(new \Pimcore\Bundle\NumberSequenceGeneratorBundle\NumberSequenceGeneratorBundle());
$collection->addBundle(new \Pimcore\Bundle\ObjectMergerBundle\ObjectMergerBundle());
if (class_exists('\\AppBundle\\AppBundle')) {
$collection->addBundle(new \AppBundle\AppBundle);
}
// Registered ahead of GlobalBundle on purpose: routes load in bundle
// registration order, and GlobalBundle's "landing" route (@Route("/")
// with no host constraint) otherwise captures "/" on every domain -
// including inspectright.local - before this bundle's own host-scoped
// root route can match. See InspectRightBundle/.../pimcore/routing.yml.
if (class_exists('\\InspectRightBundle\\InspectRightBundle')) {
$collection->addBundle(new \InspectRightBundle\InspectRightBundle);
}
if (class_exists('\\GlobalBundle\\GlobalBundle')) {
$collection->addBundle(new \GlobalBundle\GlobalBundle);
}
if (class_exists('\\WebsiteBundle\\WebsiteBundle')) {
$collection->addBundle(new \WebsiteBundle\WebsiteBundle);
}
}
}