Skip to content

Commit 1ef933d

Browse files
committed
ref
1 parent b98eebe commit 1ef933d

File tree

3 files changed

+28
-30
lines changed

3 files changed

+28
-30
lines changed

src/ai-bundle/src/AiBundle.php

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -119,14 +119,16 @@ public function loadExtension(array $config, ContainerConfigurator $container, C
119119

120120
$stores = array_keys($builder->findTaggedServiceIds('ai.store'));
121121

122-
$references = [];
123-
foreach ($stores as $storeName) {
124-
$references[$storeName] = new Reference($storeName);
125-
}
122+
if ([] !== $stores) {
123+
$references = [];
124+
foreach ($stores as $storeName) {
125+
$references[$storeName] = new Reference($storeName);
126+
}
126127

127-
$builder->getDefinition('ai.store_locator')->replaceArgument(0, $references);
128-
$builder->getDefinition('console.command.ai.setup_store')->replaceArgument(0, $stores);
129-
$builder->getDefinition('console.command.ai.drop_store')->replaceArgument(0, $stores);
128+
$builder->getDefinition('ai.store_locator')->replaceArgument(0, $references);
129+
$builder->getDefinition('console.command.ai.setup_store')->replaceArgument(0, $stores);
130+
$builder->getDefinition('console.command.ai.drop_store')->replaceArgument(0, $stores);
131+
}
130132

131133
foreach ($config['indexer'] as $indexerName => $indexer) {
132134
$this->processIndexerConfig($indexerName, $indexer, $builder);

src/store/src/Command/DropStoreCommand.php

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,15 @@
2626
/**
2727
* @author Guillaume Loulier <[email protected]>
2828
*/
29-
#[AsCommand(name: 'ai:store:drop', description: 'Drop the required infrastructure for the store')]
29+
#[AsCommand(name: 'ai:store:drop', description: 'Drop the required infrastructure for the store', help: <<<EOF
30+
The <info>%command.name%</info> command drops the stores:
31+
32+
<info>php %command.full_name%</info>
33+
34+
Or a specific store only:
35+
36+
<info>php %command.full_name% <store></info>
37+
EOF)]
3038
final class DropStoreCommand extends Command
3139
{
3240
/**
@@ -50,16 +58,6 @@ protected function configure(): void
5058
{
5159
$this
5260
->addArgument('store', InputArgument::OPTIONAL, 'Name of the store to drop')
53-
->setHelp(<<<EOF
54-
The <info>%command.name%</info> command drops the stores:
55-
56-
<info>php %command.full_name%</info>
57-
58-
Or a specific store only:
59-
60-
<info>php %command.full_name% <store></info>
61-
EOF
62-
)
6361
;
6462
}
6563

@@ -80,7 +78,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int
8078
}
8179

8280
try {
83-
$store->setup();
81+
$store->drop();
8482
$io->success(\sprintf('The "%s" store was dropped successfully.', $storeName));
8583
} catch (\Exception $e) {
8684
throw new RuntimeException(\sprintf('An error occurred while dropping the "%s" store: ', $storeName).$e->getMessage(), 0, $e);

src/store/src/Command/SetupStoreCommand.php

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,15 @@
2626
/**
2727
* @author Guillaume Loulier <[email protected]>
2828
*/
29-
#[AsCommand(name: 'ai:store:setup', description: 'Prepare the required infrastructure for the store')]
29+
#[AsCommand(name: 'ai:store:setup', description: 'Prepare the required infrastructure for the store', help: <<<EOF
30+
The <info>%command.name%</info> command setups the stores:
31+
32+
<info>php %command.full_name%</info>
33+
34+
Or a specific store only:
35+
36+
<info>php %command.full_name% <store></info>
37+
EOF)]
3038
final class SetupStoreCommand extends Command
3139
{
3240
/**
@@ -50,16 +58,6 @@ protected function configure(): void
5058
{
5159
$this
5260
->addArgument('store', InputArgument::OPTIONAL, 'Name of the store to setup')
53-
->setHelp(<<<EOF
54-
The <info>%command.name%</info> command setups the stores:
55-
56-
<info>php %command.full_name%</info>
57-
58-
Or a specific store only:
59-
60-
<info>php %command.full_name% <store></info>
61-
EOF
62-
)
6361
;
6462
}
6563

0 commit comments

Comments
 (0)