From da7871fc8b31d5a0c84383b0b64756ce462f811d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lo=C3=AFc=20Fr=C3=A9mont?= Date: Thu, 16 May 2024 09:41:21 +0200 Subject: [PATCH] Rename compiler passes --- .../Compiler/FosRestPass.php | 33 ------------ .../Compiler/HateoasPass.php | 33 ------------ src/Bundle/SyliusResourceBundle.php | 4 -- .../Compiler/FosRestPassTest.php | 51 ------------------- .../Compiler/HateoasPassTest.php | 51 ------------------- 5 files changed, 172 deletions(-) delete mode 100644 src/Bundle/DependencyInjection/Compiler/FosRestPass.php delete mode 100644 src/Bundle/DependencyInjection/Compiler/HateoasPass.php delete mode 100644 tests/Bundle/DependencyInjection/Compiler/FosRestPassTest.php delete mode 100644 tests/Bundle/DependencyInjection/Compiler/HateoasPassTest.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()); diff --git a/tests/Bundle/DependencyInjection/Compiler/FosRestPassTest.php b/tests/Bundle/DependencyInjection/Compiler/FosRestPassTest.php deleted file mode 100644 index ebecaed4e..000000000 --- a/tests/Bundle/DependencyInjection/Compiler/FosRestPassTest.php +++ /dev/null @@ -1,51 +0,0 @@ -setParameter('kernel.bundles', []); - - $this->compile(); - - $this->assertContainerBuilderNotHasService('sylius.resource_controller.view_handler'); - } - - /** @test */ - public function it_keeps_the_view_handler_if_fos_rest_is_available(): void - { - $this->setParameter('kernel.bundles', [FOSRestBundle::class]); - - $this->compile(); - - $this->assertContainerBuilderHasService('sylius.resource_controller.view_handler'); - } - - protected function registerCompilerPass(ContainerBuilder $container): void - { - $this->registerService('sylius.resource_controller.view_handler', ViewHandler::class); - $this->setParameter('kernel.bundles', []); - - $container->addCompilerPass(new FosRestPass()); - } -} diff --git a/tests/Bundle/DependencyInjection/Compiler/HateoasPassTest.php b/tests/Bundle/DependencyInjection/Compiler/HateoasPassTest.php deleted file mode 100644 index 73397541c..000000000 --- a/tests/Bundle/DependencyInjection/Compiler/HateoasPassTest.php +++ /dev/null @@ -1,51 +0,0 @@ -setParameter('kernel.bundles', []); - - $this->compile(); - - $this->assertContainerBuilderNotHasService('sylius.resource_controller.pagerfanta_representation_factory'); - } - - /** @test */ - public function it_keeps_the_view_handler_if_fos_rest_is_available(): void - { - $this->setParameter('kernel.bundles', [BazingaHateoasBundle::class]); - - $this->compile(); - - $this->assertContainerBuilderHasService('sylius.resource_controller.pagerfanta_representation_factory'); - } - - protected function registerCompilerPass(ContainerBuilder $container): void - { - $this->registerService('sylius.resource_controller.pagerfanta_representation_factory', PagerfantaFactory::class); - $this->setParameter('kernel.bundles', []); - - $container->addCompilerPass(new HateoasPass()); - } -}