File tree Expand file tree Collapse file tree 3 files changed +48
-10
lines changed
DependencyInjection/Compiler Expand file tree Collapse file tree 3 files changed +48
-10
lines changed Original file line number Diff line number Diff line change 99 <import resource =" services/**" />
1010 </imports >
1111
12- <services >
13- <service id =" sylius.modifier.order_item_quantity" class =" Sylius\Component\Order\Modifier\OrderItemQuantityModifier" public =" true" >
14- <argument type =" service" id =" sylius.factory.order_item_unit" />
15- </service >
16- <service id =" sylius.factory.add_to_cart_command" class =" Sylius\Bundle\OrderBundle\Factory\AddToCartCommandFactory" public =" true" />
17- <service id =" sylius.modifier.order" class =" Sylius\Component\Order\Modifier\OrderModifier" public =" true" >
18- <argument type =" service" id =" sylius.order_processing.order_processor" />
19- <argument type =" service" id =" sylius.modifier.order_item_quantity" />
20- </service >
21- </services >
2212</container >
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 \LegacyBridgePlugin \DependencyInjection \Compiler ;
15+
16+ use Symfony \Component \DependencyInjection \Compiler \CompilerPassInterface ;
17+ use Symfony \Component \DependencyInjection \ContainerBuilder ;
18+
19+ final class MakeServicesPublicCompilerPass implements CompilerPassInterface
20+ {
21+ /**
22+ * List of service IDs that need to be public for legacy compatibility
23+ */
24+ private const SERVICE_IDS = [
25+ 'sylius.modifier.order_item_quantity ' ,
26+ 'sylius.factory.add_to_cart_command ' ,
27+ 'sylius.modifier.order ' ,
28+ ];
29+
30+ public function process (ContainerBuilder $ container ): void
31+ {
32+ foreach (self ::SERVICE_IDS as $ serviceId ) {
33+ if (!$ container ->hasDefinition ($ serviceId ) && !$ container ->hasAlias ($ serviceId )) {
34+ continue ;
35+ }
36+
37+ if ($ container ->hasDefinition ($ serviceId )) {
38+ $ container ->getDefinition ($ serviceId )->setPublic (true );
39+ }
40+
41+ if ($ container ->hasAlias ($ serviceId )) {
42+ $ container ->getAlias ($ serviceId )->setPublic (true );
43+ }
44+ }
45+ }
46+ }
Original file line number Diff line number Diff line change 66
77use Sylius \Bundle \CoreBundle \Application \SyliusPluginTrait ;
88use Sylius \LegacyBridgePlugin \DependencyInjection \Compiler \LegacySonataBlockPass ;
9+ use Sylius \LegacyBridgePlugin \DependencyInjection \Compiler \MakeServicesPublicCompilerPass ;
910use Symfony \Component \DependencyInjection \ContainerBuilder ;
1011use Symfony \Component \HttpKernel \Bundle \Bundle ;
1112
@@ -16,6 +17,7 @@ final class SyliusLegacyBridgePlugin extends Bundle
1617 public function build (ContainerBuilder $ container ): void
1718 {
1819 $ container ->addCompilerPass (new LegacySonataBlockPass ());
20+ $ container ->addCompilerPass (new MakeServicesPublicCompilerPass ());
1921 }
2022
2123 public function getPath (): string
You can’t perform that action at this time.
0 commit comments