@@ -976,27 +976,19 @@ private function processStoreConfig(string $type, array $stores, ContainerBuilde
976976
977977 $ container ->setDefinition ('ai.store.distance_calculator. ' .$ name , $ distanceCalculatorDefinition );
978978
979- $ arguments = [
980- new Reference ($ store ['service ' ]),
981- new Reference ('ai.store.distance_calculator. ' .$ name ),
982- $ store ['cache_key ' ] ?? $ name ,
983- ];
984-
985979 if (\array_key_exists ('strategy ' , $ store ) && null !== $ store ['strategy ' ]) {
986- if (!$ container ->hasDefinition ('ai.store.distance_calculator. ' .$ name )) {
987- $ distanceCalculatorDefinition = new Definition (DistanceCalculator::class);
988- $ distanceCalculatorDefinition ->setLazy (true );
989- $ distanceCalculatorDefinition ->setArgument (0 , DistanceStrategy::from ($ store ['strategy ' ]));
990-
991- $ container ->setDefinition ('ai.store.distance_calculator. ' .$ name , $ distanceCalculatorDefinition );
992-
993- $ arguments [1 ] = new Reference ('ai.store.distance_calculator. ' .$ name );
980+ $ distanceCalculatorDefinition = $ container ->getDefinition ('ai.store.distance_calculator. ' .$ name );
981+ $ distanceCalculatorDefinition ->setArgument (0 , DistanceStrategy::from ($ store ['strategy ' ]));
994982 }
995983
996984 $ definition = new Definition (LocalCacheStore::class);
997985 $ definition
998986 ->setLazy (true )
999- ->setArguments ($ arguments )
987+ ->setArguments ([
988+ new Reference ($ store ['service ' ]),
989+ new Reference ('ai.store.distance_calculator. ' .$ name ),
990+ $ store ['cache_key ' ] ?? $ name ,
991+ ])
1000992 ->addTag ('proxy ' , ['interface ' => StoreInterface::class])
1001993 ->addTag ('proxy ' , ['interface ' => ManagedStoreInterface::class])
1002994 ->addTag ('ai.store ' );
@@ -1348,6 +1340,7 @@ private function processStoreConfig(string $type, array $stores, ContainerBuilde
13481340 ->setLazy (true )
13491341 ->setArguments ($ arguments )
13501342 ->addTag ('proxy ' , ['interface ' => StoreInterface::class])
1343+ ->addTag ('proxy ' , ['interface ' => ManagedStoreInterface::class])
13511344 ->addTag ('ai.store ' );
13521345
13531346 $ container ->setDefinition ('ai.store. ' .$ type .'. ' .$ name , $ definition );
0 commit comments