@@ -135,11 +135,18 @@ public function loadExtension(array $config, ContainerConfigurator $container, C
135
135
foreach ($ config ['store ' ] ?? [] as $ type => $ store ) {
136
136
$ this ->processStoreConfig ($ type , $ store , $ builder );
137
137
}
138
+
138
139
$ stores = array_keys ($ builder ->findTaggedServiceIds ('ai.store ' ));
140
+
139
141
if (1 === \count ($ stores )) {
140
142
$ builder ->setAlias (StoreInterface::class, reset ($ stores ));
141
143
}
142
144
145
+ if ([] === $ stores ) {
146
+ $ builder ->removeDefinition ('ai.command.setup_store ' );
147
+ $ builder ->removeDefinition ('ai.command.drop_store ' );
148
+ }
149
+
143
150
foreach ($ config ['indexer ' ] as $ indexerName => $ indexer ) {
144
151
$ this ->processIndexerConfig ($ indexerName , $ indexer , $ builder );
145
152
}
@@ -620,6 +627,7 @@ private function processStoreConfig(string $type, array $stores, ContainerBuilde
620
627
->setArguments ($ arguments );
621
628
622
629
$ container ->setDefinition ('ai.store. ' .$ type .'. ' .$ name , $ definition );
630
+ $ container ->registerAliasForArgument ('ai.store. ' .$ name , StoreInterface::class, (new Target ($ name .'Store ' ))->getParsedName ());
623
631
}
624
632
}
625
633
@@ -651,6 +659,7 @@ private function processStoreConfig(string $type, array $stores, ContainerBuilde
651
659
->setArguments ($ arguments );
652
660
653
661
$ container ->setDefinition ('ai.store. ' .$ type .'. ' .$ name , $ definition );
662
+ $ container ->registerAliasForArgument ('ai.store. ' .$ name , StoreInterface::class, (new Target ($ name .'Store ' ))->getParsedName ());
654
663
}
655
664
}
656
665
@@ -665,6 +674,7 @@ private function processStoreConfig(string $type, array $stores, ContainerBuilde
665
674
->addTag ('ai.store ' );
666
675
667
676
$ container ->setDefinition ('ai.store. ' .$ type .'. ' .$ name , $ definition );
677
+ $ container ->registerAliasForArgument ('ai.store. ' .$ name , StoreInterface::class, (new Target ($ name .'Store ' ))->getParsedName ());
668
678
}
669
679
}
670
680
@@ -691,6 +701,7 @@ private function processStoreConfig(string $type, array $stores, ContainerBuilde
691
701
;
692
702
693
703
$ container ->setDefinition ('ai.store. ' .$ type .'. ' .$ name , $ definition );
704
+ $ container ->registerAliasForArgument ('ai.store. ' .$ name , StoreInterface::class, (new Target ($ name .'Store ' ))->getParsedName ());
694
705
}
695
706
}
696
707
@@ -751,6 +762,7 @@ private function processStoreConfig(string $type, array $stores, ContainerBuilde
751
762
->setArguments ($ arguments );
752
763
753
764
$ container ->setDefinition ('ai.store. ' .$ type .'. ' .$ name , $ definition );
765
+ $ container ->registerAliasForArgument ('ai.store. ' .$ name , StoreInterface::class, (new Target ($ name .'Store ' ))->getParsedName ());
754
766
}
755
767
}
756
768
@@ -775,6 +787,7 @@ private function processStoreConfig(string $type, array $stores, ContainerBuilde
775
787
->setArguments ($ arguments );
776
788
777
789
$ container ->setDefinition ('ai.store. ' .$ type .'. ' .$ name , $ definition );
790
+ $ container ->registerAliasForArgument ('ai.store. ' .$ name , StoreInterface::class, (new Target ($ name .'Store ' ))->getParsedName ());
778
791
}
779
792
}
780
793
@@ -806,6 +819,7 @@ private function processStoreConfig(string $type, array $stores, ContainerBuilde
806
819
->setArguments ($ arguments );
807
820
808
821
$ container ->setDefinition ('ai.store. ' .$ type .'. ' .$ name , $ definition );
822
+ $ container ->registerAliasForArgument ('ai.store. ' .$ name , StoreInterface::class, (new Target ($ name .'Store ' ))->getParsedName ());
809
823
}
810
824
}
811
825
@@ -832,6 +846,7 @@ private function processStoreConfig(string $type, array $stores, ContainerBuilde
832
846
->setArguments ($ arguments );
833
847
834
848
$ container ->setDefinition ('ai.store. ' .$ type .'. ' .$ name , $ definition );
849
+ $ container ->registerAliasForArgument ('ai.store. ' .$ name , StoreInterface::class, (new Target ($ name .'Store ' ))->getParsedName ());
835
850
}
836
851
}
837
852
@@ -869,6 +884,7 @@ private function processStoreConfig(string $type, array $stores, ContainerBuilde
869
884
->setArguments ($ arguments );
870
885
871
886
$ container ->setDefinition ('ai.store. ' .$ type .'. ' .$ name , $ definition );
887
+ $ container ->registerAliasForArgument ('ai.store. ' .$ name , StoreInterface::class, (new Target ($ name .'Store ' ))->getParsedName ());
872
888
}
873
889
}
874
890
@@ -893,6 +909,7 @@ private function processStoreConfig(string $type, array $stores, ContainerBuilde
893
909
->setArguments ($ arguments );
894
910
895
911
$ container ->setDefinition ('ai.store. ' .$ type .'. ' .$ name , $ definition );
912
+ $ container ->registerAliasForArgument ('ai.store. ' .$ name , StoreInterface::class, (new Target ($ name .'Store ' ))->getParsedName ());
896
913
}
897
914
}
898
915
@@ -919,6 +936,7 @@ private function processStoreConfig(string $type, array $stores, ContainerBuilde
919
936
->setArguments ($ arguments );
920
937
921
938
$ container ->setDefinition ('ai.store. ' .$ type .'. ' .$ name , $ definition );
939
+ $ container ->registerAliasForArgument ('ai.store. ' .$ name , StoreInterface::class, (new Target ($ name .'Store ' ))->getParsedName ());
922
940
}
923
941
}
924
942
@@ -959,6 +977,7 @@ private function processStoreConfig(string $type, array $stores, ContainerBuilde
959
977
->setArguments ($ arguments );
960
978
961
979
$ container ->setDefinition ('ai.store. ' .$ type .'. ' .$ name , $ definition );
980
+ $ container ->registerAliasForArgument ('ai.store. ' .$ name , StoreInterface::class, (new Target ($ name .'Store ' ))->getParsedName ());
962
981
}
963
982
}
964
983
@@ -985,6 +1004,7 @@ private function processStoreConfig(string $type, array $stores, ContainerBuilde
985
1004
->setArguments ($ arguments );
986
1005
987
1006
$ container ->setDefinition ('ai.store. ' .$ type .'. ' .$ name , $ definition );
1007
+ $ container ->registerAliasForArgument ('ai.store. ' .$ name , StoreInterface::class, (new Target ($ name .'Store ' ))->getParsedName ());
988
1008
}
989
1009
}
990
1010
0 commit comments