Skip to content

Commit

Permalink
IBX-1589: Provided BC layer for all Ibexa Symfony Extension names (#5)
Browse files Browse the repository at this point in the history
For more details see https://issues.ibexa.co/browse/IBX-1589

* Overridden config:dump-reference to use custom ContainerBuilder (similar to #4)

* Created extension name map
  • Loading branch information
alongosz authored Dec 3, 2021
1 parent 6d2b321 commit f71fc9d
Show file tree
Hide file tree
Showing 4 changed files with 86 additions and 5 deletions.
18 changes: 18 additions & 0 deletions src/bundle/Command/SymfonyConfigDumpReferenceCommand.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<?php

/**
* @copyright Copyright (C) Ibexa AS. All rights reserved.
* @license For full copyright and license information view LICENSE file distributed with this source code.
*/
declare(strict_types=1);

namespace Ibexa\Bundle\CompatibilityLayer\Command;

use Symfony\Bundle\FrameworkBundle\Command\ConfigDumpReferenceCommand;

class SymfonyConfigDumpReferenceCommand extends ConfigDumpReferenceCommand
{
use BuildDebugContainerTrait;

protected static $defaultName = 'config:dump-reference';
}
15 changes: 10 additions & 5 deletions src/bundle/DependencyInjection/ContainerBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

namespace Ibexa\Bundle\CompatibilityLayer\DependencyInjection;

use Ibexa\Bundle\CompatibilityLayer\IbexaCompatibilityLayerBundle;
use Symfony\Component\DependencyInjection\ContainerBuilder as SymfonyContainerBuilder;
use Symfony\Component\DependencyInjection\Extension\ExtensionInterface;

Expand All @@ -16,10 +17,8 @@
*/
final class ContainerBuilder extends SymfonyContainerBuilder
{
public const EXTENSION_NAME_BC_MAP = [
'ezpublish' => 'ibexa',
'ezplatform' => 'ibexa',
];
/** @var array<string, string> */
private static $extensionNameMap;

public function hasExtension(string $name): bool
{
Expand Down Expand Up @@ -52,6 +51,12 @@ public function prependExtensionConfig(string $name, array $config): void

private function resolveExtensionName(string $name): string
{
return self::EXTENSION_NAME_BC_MAP[$name] ?? $name;
if (!isset(self::$extensionNameMap)) {
/** @noinspection PhpIncludeInspection */
self::$extensionNameMap = require IbexaCompatibilityLayerBundle::MAPPINGS_PATH
. \DIRECTORY_SEPARATOR . 'symfony-extension-name-map.php';
}

return self::$extensionNameMap[$name] ?? $name;
}
}
2 changes: 2 additions & 0 deletions src/bundle/Resources/config/services.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,5 @@ services:
$innerEventDispatcher: '@.inner'

Ibexa\Bundle\CompatibilityLayer\Command\SymfonyConfigDebugCommand: ~

Ibexa\Bundle\CompatibilityLayer\Command\SymfonyConfigDumpReferenceCommand: ~
56 changes: 56 additions & 0 deletions src/bundle/Resources/mappings/symfony-extension-name-map.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
<?php

/**
* @copyright Copyright (C) Ibexa AS. All rights reserved.
* @license For full copyright and license information view LICENSE file distributed with this source code.
*/
declare(strict_types=1);

return [
'ezpublish' => 'ibexa',
'ezplatform' => 'ibexa',
'ezdesign' => 'ibexa_design_engine',
'ez_doctrine_schema' => 'ibexa_doctrine_schema',
'ez_io' => 'ibexa_io',
'ezplatform_elastic_search_engine' => 'ibexa_elasticsearch',
'ez_platform_fastly_cache' => 'ibexa_fastly',
'ezplatform_form_builder' => 'ibexa_form_builder',
'ezplatform_graphql' => 'ibexa_graphql',
'ez_platform_http_cache' => 'ibexa_http_cache',
'ez_platform_page_builder' => 'ibexa_page_builder',
'ezplatform_page_fieldtype' => 'ibexa_fieldtype_page',
'ez_platform_standard_design' => 'ibexa_standard_design',
'ezplatform_support_tools' => 'ibexa_system_info',
'ezrecommendation' => 'ibexa_personalization_client',
'ezrichtext' => 'ibexa_fieldtype_richtext',
'ez_platform_version_comparison' => 'ibexa_version_comparison',
'ez_publish_rest' => 'ibexa_rest',
'ez_search_engine_legacy' => 'ibexa_legacy_search_engine',
'ez_search_engine_solr' => 'ibexa_solr',
'ez_systems_date_based_publisher' => 'ibexa_scheduler',
'ezplatform_site_factory' => 'ibexa_site_factory',
'ibexa_platform_commerce_field_types' => 'ibexa_commerce_field_types',
'one_sky' => 'ibexa_commerce_one_sky',
'ses_specificationstypefieldtype' => 'ibexa_commerce_specifications_type',
'shop_price_engine_plugin' => 'ibexa_commerce_price_engine',
'silversolutions_eshop' => 'ibexa_commerce_eshop',
'silversolutions_tools' => 'ibexa_commerce_shop_tools',
'silversolutions_translation' => 'ibexa_commerce_translation',
'siso_admin_erp' => 'ibexa_commerce_erp_admin',
'siso_basket' => 'ibexa_commerce_basket',
'siso_checkout' => 'ibexa_commerce_checkout',
'siso_comparison' => 'ibexa_commerce_comparison',
'siso_content_plugin' => 'ibexa_commerce_base_design',
'siso_ez_studio' => 'ibexa_commerce_ez_studio',
'siso_local_order_management' => 'ibexa_commerce_local_order_management',
'siso_newsletter' => 'ibexa_commerce_newsletter',
'siso_order_history' => 'ibexa_commerce_order_history',
'siso_payment' => 'ibexa_commerce_payment',
'siso_price' => 'ibexa_commerce_price',
'siso_quick_order' => 'ibexa_commerce_quick_order',
'siso_search' => 'ibexa_commerce_search',
'siso_shop_frontend' => 'ibexa_commerce_shop_frontend',
'siso_test' => 'ibexa_commerce_test_tools',
'siso_tools' => 'ibexa_commerce_tools',
'siso_voucher' => 'ibexa_commerce_voucher',
];

0 comments on commit f71fc9d

Please sign in to comment.