Skip to content

Commit

Permalink
Load CoreBundle's serializer config only if AdminApiBundle is not loaded
Browse files Browse the repository at this point in the history
  • Loading branch information
pamil committed Apr 20, 2021
1 parent dbf8934 commit d54ab36
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ public function prepend(ContainerBuilder $container): void
$this->prependSyliusThemeBundle($container, $config['driver']);
$this->prependHwiOauth($container);
$this->prependDoctrineMigrations($container);
$this->prependJmsSerializerIfAdminApiBundleIsNotPresent($container);
}

protected function getMigrationsNamespace(): string
Expand Down Expand Up @@ -110,4 +111,29 @@ private function prependSyliusThemeBundle(ContainerBuilder $container, string $d

$container->prependExtensionConfig('sylius_theme', ['context' => 'sylius.theme.context.channel_based']);
}

private function prependJmsSerializerIfAdminApiBundleIsNotPresent(ContainerBuilder $container): void
{
if (!$container->hasExtension('jms_serializer')) {
return;
}

if ($container->hasExtension('sylius_admin_api')) {
return;
}

$container->prependExtensionConfig('jms_serializer', [
'metadata' => [
'directories' => [
'sylius-core' => [
'namespace_prefix' => 'Sylius\Component\Core',
'path' => '@SyliusCoreBundle/Resources/config/serializer',
],
],
],
'property_naming' => [
'id' => 'jms_serializer.identical_property_naming_strategy',
],
]);
}
}
9 changes: 0 additions & 9 deletions src/Sylius/Bundle/CoreBundle/Resources/config/app/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,15 +43,6 @@ doctrine:
WEEK: Sylius\Bundle\CoreBundle\Doctrine\DQL\Week
YEAR: Sylius\Bundle\CoreBundle\Doctrine\DQL\Year

jms_serializer:
metadata:
directories:
sylius-core:
namespace_prefix: "Sylius\\Component\\Core"
path: "@SyliusCoreBundle/Resources/config/serializer"
property_naming:
id: jms_serializer.identical_property_naming_strategy

knp_gaufrette:
adapters:
sylius_image:
Expand Down

0 comments on commit d54ab36

Please sign in to comment.