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