@@ -136,11 +136,18 @@ public function loadExtension(array $config, ContainerConfigurator $container, C
136136 foreach ($ config ['store ' ] ?? [] as $ type => $ store ) {
137137 $ this ->processStoreConfig ($ type , $ store , $ builder );
138138 }
139+
139140 $ stores = array_keys ($ builder ->findTaggedServiceIds ('ai.store ' ));
141+
140142 if (1 === \count ($ stores )) {
141143 $ builder ->setAlias (StoreInterface::class, reset ($ stores ));
142144 }
143145
146+ if ([] === $ stores ) {
147+ $ builder ->removeDefinition ('ai.command.setup_store ' );
148+ $ builder ->removeDefinition ('ai.command.drop_store ' );
149+ }
150+
144151 foreach ($ config ['indexer ' ] as $ indexerName => $ indexer ) {
145152 $ this ->processIndexerConfig ($ indexerName , $ indexer , $ builder );
146153 }
@@ -621,6 +628,7 @@ private function processStoreConfig(string $type, array $stores, ContainerBuilde
621628 ->setArguments ($ arguments );
622629
623630 $ container ->setDefinition ('ai.store. ' .$ type .'. ' .$ name , $ definition );
631+ $ container ->registerAliasForArgument ('ai.store. ' .$ name , StoreInterface::class, (new Target ($ name .'Store ' ))->getParsedName ());
624632 }
625633 }
626634
@@ -652,6 +660,7 @@ private function processStoreConfig(string $type, array $stores, ContainerBuilde
652660 ->setArguments ($ arguments );
653661
654662 $ container ->setDefinition ('ai.store. ' .$ type .'. ' .$ name , $ definition );
663+ $ container ->registerAliasForArgument ('ai.store. ' .$ name , StoreInterface::class, (new Target ($ name .'Store ' ))->getParsedName ());
655664 }
656665 }
657666
@@ -666,6 +675,7 @@ private function processStoreConfig(string $type, array $stores, ContainerBuilde
666675 ->addTag ('ai.store ' );
667676
668677 $ container ->setDefinition ('ai.store. ' .$ type .'. ' .$ name , $ definition );
678+ $ container ->registerAliasForArgument ('ai.store. ' .$ name , StoreInterface::class, (new Target ($ name .'Store ' ))->getParsedName ());
669679 }
670680 }
671681
@@ -692,6 +702,7 @@ private function processStoreConfig(string $type, array $stores, ContainerBuilde
692702 ;
693703
694704 $ container ->setDefinition ('ai.store. ' .$ type .'. ' .$ name , $ definition );
705+ $ container ->registerAliasForArgument ('ai.store. ' .$ name , StoreInterface::class, (new Target ($ name .'Store ' ))->getParsedName ());
695706 }
696707 }
697708
@@ -752,6 +763,7 @@ private function processStoreConfig(string $type, array $stores, ContainerBuilde
752763 ->setArguments ($ arguments );
753764
754765 $ container ->setDefinition ('ai.store. ' .$ type .'. ' .$ name , $ definition );
766+ $ container ->registerAliasForArgument ('ai.store. ' .$ name , StoreInterface::class, (new Target ($ name .'Store ' ))->getParsedName ());
755767 }
756768 }
757769
@@ -776,6 +788,7 @@ private function processStoreConfig(string $type, array $stores, ContainerBuilde
776788 ->setArguments ($ arguments );
777789
778790 $ container ->setDefinition ('ai.store. ' .$ type .'. ' .$ name , $ definition );
791+ $ container ->registerAliasForArgument ('ai.store. ' .$ name , StoreInterface::class, (new Target ($ name .'Store ' ))->getParsedName ());
779792 }
780793 }
781794
@@ -807,6 +820,7 @@ private function processStoreConfig(string $type, array $stores, ContainerBuilde
807820 ->setArguments ($ arguments );
808821
809822 $ container ->setDefinition ('ai.store. ' .$ type .'. ' .$ name , $ definition );
823+ $ container ->registerAliasForArgument ('ai.store. ' .$ name , StoreInterface::class, (new Target ($ name .'Store ' ))->getParsedName ());
810824 }
811825 }
812826
@@ -833,6 +847,7 @@ private function processStoreConfig(string $type, array $stores, ContainerBuilde
833847 ->setArguments ($ arguments );
834848
835849 $ container ->setDefinition ('ai.store. ' .$ type .'. ' .$ name , $ definition );
850+ $ container ->registerAliasForArgument ('ai.store. ' .$ name , StoreInterface::class, (new Target ($ name .'Store ' ))->getParsedName ());
836851 }
837852 }
838853
@@ -870,6 +885,7 @@ private function processStoreConfig(string $type, array $stores, ContainerBuilde
870885 ->setArguments ($ arguments );
871886
872887 $ container ->setDefinition ('ai.store. ' .$ type .'. ' .$ name , $ definition );
888+ $ container ->registerAliasForArgument ('ai.store. ' .$ name , StoreInterface::class, (new Target ($ name .'Store ' ))->getParsedName ());
873889 }
874890 }
875891
@@ -894,6 +910,7 @@ private function processStoreConfig(string $type, array $stores, ContainerBuilde
894910 ->setArguments ($ arguments );
895911
896912 $ container ->setDefinition ('ai.store. ' .$ type .'. ' .$ name , $ definition );
913+ $ container ->registerAliasForArgument ('ai.store. ' .$ name , StoreInterface::class, (new Target ($ name .'Store ' ))->getParsedName ());
897914 }
898915 }
899916
@@ -920,6 +937,7 @@ private function processStoreConfig(string $type, array $stores, ContainerBuilde
920937 ->setArguments ($ arguments );
921938
922939 $ container ->setDefinition ('ai.store. ' .$ type .'. ' .$ name , $ definition );
940+ $ container ->registerAliasForArgument ('ai.store. ' .$ name , StoreInterface::class, (new Target ($ name .'Store ' ))->getParsedName ());
923941 }
924942 }
925943
@@ -960,6 +978,7 @@ private function processStoreConfig(string $type, array $stores, ContainerBuilde
960978 ->setArguments ($ arguments );
961979
962980 $ container ->setDefinition ('ai.store. ' .$ type .'. ' .$ name , $ definition );
981+ $ container ->registerAliasForArgument ('ai.store. ' .$ name , StoreInterface::class, (new Target ($ name .'Store ' ))->getParsedName ());
963982 }
964983 }
965984
@@ -986,6 +1005,7 @@ private function processStoreConfig(string $type, array $stores, ContainerBuilde
9861005 ->setArguments ($ arguments );
9871006
9881007 $ container ->setDefinition ('ai.store. ' .$ type .'. ' .$ name , $ definition );
1008+ $ container ->registerAliasForArgument ('ai.store. ' .$ name , StoreInterface::class, (new Target ($ name .'Store ' ))->getParsedName ());
9891009 }
9901010 }
9911011
0 commit comments