File tree Expand file tree Collapse file tree 3 files changed +70
-0
lines changed
DependencyInjection/Compiler Expand file tree Collapse file tree 3 files changed +70
-0
lines changed Original file line number Diff line number Diff line change 1+ <?php
2+
3+ /*
4+ * This file is part of the Sylius package.
5+ *
6+ * (c) Sylius Sp. z o.o.
7+ *
8+ * For the full copyright and license information, please view the LICENSE
9+ * file that was distributed with this source code.
10+ */
11+
12+ declare (strict_types=1 );
13+
14+ namespace Sylius \Bundle \ResourceBundle \DependencyInjection \Compiler ;
15+
16+ use FOS \RestBundle \FOSRestBundle ;
17+ use Symfony \Component \DependencyInjection \Compiler \CompilerPassInterface ;
18+ use Symfony \Component \DependencyInjection \ContainerBuilder ;
19+
20+ final class FosRestPass implements CompilerPassInterface
21+ {
22+ public function process (ContainerBuilder $ container ): void
23+ {
24+ /** @var array $bundles */
25+ $ bundles = $ container ->getParameter ('kernel.bundles ' );
26+
27+ if (in_array (FOSRestBundle::class, $ bundles , true )) {
28+ return ;
29+ }
30+
31+ $ container ->removeDefinition ('sylius.resource_controller.view_handler ' );
32+ }
33+ }
Original file line number Diff line number Diff line change 1+ <?php
2+
3+ /*
4+ * This file is part of the Sylius package.
5+ *
6+ * (c) Sylius Sp. z o.o.
7+ *
8+ * For the full copyright and license information, please view the LICENSE
9+ * file that was distributed with this source code.
10+ */
11+
12+ declare (strict_types=1 );
13+
14+ namespace Sylius \Bundle \ResourceBundle \DependencyInjection \Compiler ;
15+
16+ use Bazinga \Bundle \HateoasBundle \BazingaHateoasBundle ;
17+ use Symfony \Component \DependencyInjection \Compiler \CompilerPassInterface ;
18+ use Symfony \Component \DependencyInjection \ContainerBuilder ;
19+
20+ final class HateoasPass implements CompilerPassInterface
21+ {
22+ public function process (ContainerBuilder $ container ): void
23+ {
24+ /** @var array $bundles */
25+ $ bundles = $ container ->getParameter ('kernel.bundles ' );
26+
27+ if (in_array (BazingaHateoasBundle::class, $ bundles , true )) {
28+ return ;
29+ }
30+
31+ $ container ->removeDefinition ('sylius.resource_controller.pagerfanta_representation_factory ' );
32+ }
33+ }
Original file line number Diff line number Diff line change 1616use Sylius \Bundle \ResourceBundle \DependencyInjection \Compiler \CsrfTokenManagerPass ;
1717use Sylius \Bundle \ResourceBundle \DependencyInjection \Compiler \DoctrineContainerRepositoryFactoryPass ;
1818use Sylius \Bundle \ResourceBundle \DependencyInjection \Compiler \DoctrineTargetEntitiesResolverPass ;
19+ use Sylius \Bundle \ResourceBundle \DependencyInjection \Compiler \FosRestPass ;
20+ use Sylius \Bundle \ResourceBundle \DependencyInjection \Compiler \HateoasPass ;
1921use Sylius \Bundle \ResourceBundle \DependencyInjection \Compiler \Helper \TargetEntitiesResolver ;
2022use Sylius \Bundle \ResourceBundle \DependencyInjection \Compiler \PagerfantaBridgePass ;
2123use Sylius \Bundle \ResourceBundle \DependencyInjection \Compiler \RegisterFormBuilderPass ;
@@ -52,6 +54,8 @@ public function build(ContainerBuilder $container): void
5254 $ container ->addCompilerPass (new DisableMetadataCachePass ());
5355 $ container ->addCompilerPass (new DoctrineContainerRepositoryFactoryPass ());
5456 $ container ->addCompilerPass (new DoctrineTargetEntitiesResolverPass (new TargetEntitiesResolver ()), PassConfig::TYPE_BEFORE_OPTIMIZATION , 1 );
57+ $ container ->addCompilerPass (new FosRestPass ());
58+ $ container ->addCompilerPass (new HateoasPass ());
5559 $ container ->addCompilerPass (new RegisterFormBuilderPass ());
5660 $ container ->addCompilerPass (new RegisterFqcnControllersPass ());
5761 $ container ->addCompilerPass (new RegisterResourceRepositoryPass ());
You can’t perform that action at this time.
0 commit comments