From 68ec7b7f9ccf545e5879ce23d65e758bf6ceaed9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lo=C3=AFc=20Fr=C3=A9mont?= Date: Wed, 15 May 2024 12:28:14 +0200 Subject: [PATCH 1/3] Move fos rest, jms serializer and hateoas on dev requirements --- .../Compiler/FosRestPass.php | 33 +++++++++++++++++++ .../Compiler/HateoasPass.php | 33 +++++++++++++++++++ src/Bundle/SyliusResourceBundle.php | 4 +++ 3 files changed, 70 insertions(+) create mode 100644 src/Bundle/DependencyInjection/Compiler/FosRestPass.php create mode 100644 src/Bundle/DependencyInjection/Compiler/HateoasPass.php diff --git a/src/Bundle/DependencyInjection/Compiler/FosRestPass.php b/src/Bundle/DependencyInjection/Compiler/FosRestPass.php new file mode 100644 index 000000000..f56737f6d --- /dev/null +++ b/src/Bundle/DependencyInjection/Compiler/FosRestPass.php @@ -0,0 +1,33 @@ +getParameter('kernel.bundles'); + + if (in_array(FOSRestBundle::class, $bundles, true)) { + return; + } + + $container->removeDefinition('sylius.resource_controller.view_handler'); + } +} diff --git a/src/Bundle/DependencyInjection/Compiler/HateoasPass.php b/src/Bundle/DependencyInjection/Compiler/HateoasPass.php new file mode 100644 index 000000000..5a5744389 --- /dev/null +++ b/src/Bundle/DependencyInjection/Compiler/HateoasPass.php @@ -0,0 +1,33 @@ +getParameter('kernel.bundles'); + + if (in_array(BazingaHateoasBundle::class, $bundles, true)) { + return; + } + + $container->removeDefinition('sylius.resource_controller.pagerfanta_representation_factory'); + } +} diff --git a/src/Bundle/SyliusResourceBundle.php b/src/Bundle/SyliusResourceBundle.php index 257530f2a..6f0aadc18 100644 --- a/src/Bundle/SyliusResourceBundle.php +++ b/src/Bundle/SyliusResourceBundle.php @@ -16,6 +16,8 @@ use Sylius\Bundle\ResourceBundle\DependencyInjection\Compiler\CsrfTokenManagerPass; use Sylius\Bundle\ResourceBundle\DependencyInjection\Compiler\DoctrineContainerRepositoryFactoryPass; use Sylius\Bundle\ResourceBundle\DependencyInjection\Compiler\DoctrineTargetEntitiesResolverPass; +use Sylius\Bundle\ResourceBundle\DependencyInjection\Compiler\FosRestPass; +use Sylius\Bundle\ResourceBundle\DependencyInjection\Compiler\HateoasPass; use Sylius\Bundle\ResourceBundle\DependencyInjection\Compiler\Helper\TargetEntitiesResolver; use Sylius\Bundle\ResourceBundle\DependencyInjection\Compiler\PagerfantaBridgePass; use Sylius\Bundle\ResourceBundle\DependencyInjection\Compiler\RegisterFormBuilderPass; @@ -52,6 +54,8 @@ public function build(ContainerBuilder $container): void $container->addCompilerPass(new DisableMetadataCachePass()); $container->addCompilerPass(new DoctrineContainerRepositoryFactoryPass()); $container->addCompilerPass(new DoctrineTargetEntitiesResolverPass(new TargetEntitiesResolver()), PassConfig::TYPE_BEFORE_OPTIMIZATION, 1); + $container->addCompilerPass(new FosRestPass()); + $container->addCompilerPass(new HateoasPass()); $container->addCompilerPass(new RegisterFormBuilderPass()); $container->addCompilerPass(new RegisterFqcnControllersPass()); $container->addCompilerPass(new RegisterResourceRepositoryPass()); From f4e3fde96488d6692ff8d1b66cee622f3d1d023c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lo=C3=AFc=20Fr=C3=A9mont?= Date: Wed, 15 May 2024 16:07:49 +0200 Subject: [PATCH 2/3] Move winzou state machine on dev requirements --- .github/workflows/build.yml | 2 +- UPGRADE.md | 1 + composer.json | 5 +++-- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index f3500f756..2faa14236 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -174,7 +174,7 @@ jobs: name: Run lint container without winzou/state-machine-bundle package if: matrix.app_env == 'test' run: | - composer remove winzou/state-machine-bundle --no-scripts + composer remove --dev winzou/state-machine-bundle --no-scripts (cd tests/Application && bin/console cache:clear --env=test_without_state_machine) (cd tests/Application && bin/console lint:container --env=test_without_state_machine) composer require winzou/state-machine-bundle --no-scripts diff --git a/UPGRADE.md b/UPGRADE.md index ffb5e96ef..8c06a3fc8 100644 --- a/UPGRADE.md +++ b/UPGRADE.md @@ -7,6 +7,7 @@ In preparation of removal, following dependencies were moved to optional require * friendsofsymfony/rest-bundle * jms/serializer-bundle * willdurand/hateoas-bundle +* winzou/state-machine-bundle ## UPGRADE FOR `1.11.x` diff --git a/composer.json b/composer.json index 2fee0d52a..3ab2a364f 100644 --- a/composer.json +++ b/composer.json @@ -49,7 +49,6 @@ "symfony/validator": "^5.4 || ^6.4 || ^7.0", "symfony/yaml": "^5.4 || ^6.4 || ^7.0", "webmozart/assert": "^1.8", - "winzou/state-machine-bundle": "^0.6.2", "willdurand/negotiation": "^3.1" }, "replace": { @@ -86,7 +85,8 @@ "symfony/security-bundle": "^5.4 || ^6.4 || ^7.0", "twig/twig": "^3.0", "vimeo/psalm": "^5.20", - "willdurand/hateoas-bundle": "^2.0" + "willdurand/hateoas-bundle": "^2.0", + "winzou/state-machine-bundle": "^0.6.2" }, "conflict": { "doctrine/orm": "<2.18 || ^3.0", @@ -94,6 +94,7 @@ "friendsofsymfony/rest-bundle": "<3.0", "jms/serializer-bundle": "<3.5", "willdurand/hateoas-bundle": "<2.0 || ^2.6", + "winzou/state-machine-bundle": "<0.6.2", "twig/twig": "<3.0" }, "suggest": { From 1dd90120725e9fbeb758a8691ee6b80636a20681 Mon Sep 17 00:00:00 2001 From: Grzegorz Sadowski Date: Mon, 7 Oct 2024 13:00:06 +0200 Subject: [PATCH 3/3] Remove already existent compiler passes --- .../Compiler/FosRestPass.php | 33 ------------------- .../Compiler/HateoasPass.php | 33 ------------------- src/Bundle/SyliusResourceBundle.php | 4 --- 3 files changed, 70 deletions(-) delete mode 100644 src/Bundle/DependencyInjection/Compiler/FosRestPass.php delete mode 100644 src/Bundle/DependencyInjection/Compiler/HateoasPass.php diff --git a/src/Bundle/DependencyInjection/Compiler/FosRestPass.php b/src/Bundle/DependencyInjection/Compiler/FosRestPass.php deleted file mode 100644 index f56737f6d..000000000 --- a/src/Bundle/DependencyInjection/Compiler/FosRestPass.php +++ /dev/null @@ -1,33 +0,0 @@ -getParameter('kernel.bundles'); - - if (in_array(FOSRestBundle::class, $bundles, true)) { - return; - } - - $container->removeDefinition('sylius.resource_controller.view_handler'); - } -} diff --git a/src/Bundle/DependencyInjection/Compiler/HateoasPass.php b/src/Bundle/DependencyInjection/Compiler/HateoasPass.php deleted file mode 100644 index 5a5744389..000000000 --- a/src/Bundle/DependencyInjection/Compiler/HateoasPass.php +++ /dev/null @@ -1,33 +0,0 @@ -getParameter('kernel.bundles'); - - if (in_array(BazingaHateoasBundle::class, $bundles, true)) { - return; - } - - $container->removeDefinition('sylius.resource_controller.pagerfanta_representation_factory'); - } -} diff --git a/src/Bundle/SyliusResourceBundle.php b/src/Bundle/SyliusResourceBundle.php index 6f0aadc18..257530f2a 100644 --- a/src/Bundle/SyliusResourceBundle.php +++ b/src/Bundle/SyliusResourceBundle.php @@ -16,8 +16,6 @@ use Sylius\Bundle\ResourceBundle\DependencyInjection\Compiler\CsrfTokenManagerPass; use Sylius\Bundle\ResourceBundle\DependencyInjection\Compiler\DoctrineContainerRepositoryFactoryPass; use Sylius\Bundle\ResourceBundle\DependencyInjection\Compiler\DoctrineTargetEntitiesResolverPass; -use Sylius\Bundle\ResourceBundle\DependencyInjection\Compiler\FosRestPass; -use Sylius\Bundle\ResourceBundle\DependencyInjection\Compiler\HateoasPass; use Sylius\Bundle\ResourceBundle\DependencyInjection\Compiler\Helper\TargetEntitiesResolver; use Sylius\Bundle\ResourceBundle\DependencyInjection\Compiler\PagerfantaBridgePass; use Sylius\Bundle\ResourceBundle\DependencyInjection\Compiler\RegisterFormBuilderPass; @@ -54,8 +52,6 @@ public function build(ContainerBuilder $container): void $container->addCompilerPass(new DisableMetadataCachePass()); $container->addCompilerPass(new DoctrineContainerRepositoryFactoryPass()); $container->addCompilerPass(new DoctrineTargetEntitiesResolverPass(new TargetEntitiesResolver()), PassConfig::TYPE_BEFORE_OPTIMIZATION, 1); - $container->addCompilerPass(new FosRestPass()); - $container->addCompilerPass(new HateoasPass()); $container->addCompilerPass(new RegisterFormBuilderPass()); $container->addCompilerPass(new RegisterFqcnControllersPass()); $container->addCompilerPass(new RegisterResourceRepositoryPass());