@@ -135,11 +135,18 @@ public function loadExtension(array $config, ContainerConfigurator $container, C
135135 foreach ($ config ['store ' ] ?? [] as $ type => $ store ) {
136136 $ this ->processStoreConfig ($ type , $ store , $ builder );
137137 }
138+
138139 $ stores = array_keys ($ builder ->findTaggedServiceIds ('ai.store ' ));
140+
139141 if (1 === \count ($ stores )) {
140142 $ builder ->setAlias (StoreInterface::class, reset ($ stores ));
141143 }
142144
145+ if ([] === $ stores ) {
146+ $ builder ->removeDefinition ('ai.command.setup_store ' );
147+ $ builder ->removeDefinition ('ai.command.drop_store ' );
148+ }
149+
143150 foreach ($ config ['indexer ' ] as $ indexerName => $ indexer ) {
144151 $ this ->processIndexerConfig ($ indexerName , $ indexer , $ builder );
145152 }
@@ -620,6 +627,7 @@ private function processStoreConfig(string $type, array $stores, ContainerBuilde
620627 ->setArguments ($ arguments );
621628
622629 $ container ->setDefinition ('ai.store. ' .$ type .'. ' .$ name , $ definition );
630+ $ container ->registerAliasForArgument ('ai.store. ' .$ name , StoreInterface::class, (new Target ($ name .'Store ' ))->getParsedName ());
623631 }
624632 }
625633
@@ -651,6 +659,7 @@ private function processStoreConfig(string $type, array $stores, ContainerBuilde
651659 ->setArguments ($ arguments );
652660
653661 $ container ->setDefinition ('ai.store. ' .$ type .'. ' .$ name , $ definition );
662+ $ container ->registerAliasForArgument ('ai.store. ' .$ name , StoreInterface::class, (new Target ($ name .'Store ' ))->getParsedName ());
654663 }
655664 }
656665
@@ -665,6 +674,7 @@ private function processStoreConfig(string $type, array $stores, ContainerBuilde
665674 ->addTag ('ai.store ' );
666675
667676 $ container ->setDefinition ('ai.store. ' .$ type .'. ' .$ name , $ definition );
677+ $ container ->registerAliasForArgument ('ai.store. ' .$ name , StoreInterface::class, (new Target ($ name .'Store ' ))->getParsedName ());
668678 }
669679 }
670680
@@ -691,6 +701,7 @@ private function processStoreConfig(string $type, array $stores, ContainerBuilde
691701 ;
692702
693703 $ container ->setDefinition ('ai.store. ' .$ type .'. ' .$ name , $ definition );
704+ $ container ->registerAliasForArgument ('ai.store. ' .$ name , StoreInterface::class, (new Target ($ name .'Store ' ))->getParsedName ());
694705 }
695706 }
696707
@@ -751,6 +762,7 @@ private function processStoreConfig(string $type, array $stores, ContainerBuilde
751762 ->setArguments ($ arguments );
752763
753764 $ container ->setDefinition ('ai.store. ' .$ type .'. ' .$ name , $ definition );
765+ $ container ->registerAliasForArgument ('ai.store. ' .$ name , StoreInterface::class, (new Target ($ name .'Store ' ))->getParsedName ());
754766 }
755767 }
756768
@@ -775,6 +787,7 @@ private function processStoreConfig(string $type, array $stores, ContainerBuilde
775787 ->setArguments ($ arguments );
776788
777789 $ container ->setDefinition ('ai.store. ' .$ type .'. ' .$ name , $ definition );
790+ $ container ->registerAliasForArgument ('ai.store. ' .$ name , StoreInterface::class, (new Target ($ name .'Store ' ))->getParsedName ());
778791 }
779792 }
780793
@@ -806,6 +819,7 @@ private function processStoreConfig(string $type, array $stores, ContainerBuilde
806819 ->setArguments ($ arguments );
807820
808821 $ container ->setDefinition ('ai.store. ' .$ type .'. ' .$ name , $ definition );
822+ $ container ->registerAliasForArgument ('ai.store. ' .$ name , StoreInterface::class, (new Target ($ name .'Store ' ))->getParsedName ());
809823 }
810824 }
811825
@@ -832,6 +846,7 @@ private function processStoreConfig(string $type, array $stores, ContainerBuilde
832846 ->setArguments ($ arguments );
833847
834848 $ container ->setDefinition ('ai.store. ' .$ type .'. ' .$ name , $ definition );
849+ $ container ->registerAliasForArgument ('ai.store. ' .$ name , StoreInterface::class, (new Target ($ name .'Store ' ))->getParsedName ());
835850 }
836851 }
837852
@@ -869,6 +884,7 @@ private function processStoreConfig(string $type, array $stores, ContainerBuilde
869884 ->setArguments ($ arguments );
870885
871886 $ container ->setDefinition ('ai.store. ' .$ type .'. ' .$ name , $ definition );
887+ $ container ->registerAliasForArgument ('ai.store. ' .$ name , StoreInterface::class, (new Target ($ name .'Store ' ))->getParsedName ());
872888 }
873889 }
874890
@@ -893,6 +909,7 @@ private function processStoreConfig(string $type, array $stores, ContainerBuilde
893909 ->setArguments ($ arguments );
894910
895911 $ container ->setDefinition ('ai.store. ' .$ type .'. ' .$ name , $ definition );
912+ $ container ->registerAliasForArgument ('ai.store. ' .$ name , StoreInterface::class, (new Target ($ name .'Store ' ))->getParsedName ());
896913 }
897914 }
898915
@@ -919,6 +936,7 @@ private function processStoreConfig(string $type, array $stores, ContainerBuilde
919936 ->setArguments ($ arguments );
920937
921938 $ container ->setDefinition ('ai.store. ' .$ type .'. ' .$ name , $ definition );
939+ $ container ->registerAliasForArgument ('ai.store. ' .$ name , StoreInterface::class, (new Target ($ name .'Store ' ))->getParsedName ());
922940 }
923941 }
924942
@@ -959,6 +977,7 @@ private function processStoreConfig(string $type, array $stores, ContainerBuilde
959977 ->setArguments ($ arguments );
960978
961979 $ container ->setDefinition ('ai.store. ' .$ type .'. ' .$ name , $ definition );
980+ $ container ->registerAliasForArgument ('ai.store. ' .$ name , StoreInterface::class, (new Target ($ name .'Store ' ))->getParsedName ());
962981 }
963982 }
964983
@@ -985,6 +1004,7 @@ private function processStoreConfig(string $type, array $stores, ContainerBuilde
9851004 ->setArguments ($ arguments );
9861005
9871006 $ container ->setDefinition ('ai.store. ' .$ type .'. ' .$ name , $ definition );
1007+ $ container ->registerAliasForArgument ('ai.store. ' .$ name , StoreInterface::class, (new Target ($ name .'Store ' ))->getParsedName ());
9881008 }
9891009 }
9901010
0 commit comments