Skip to content

Commit 3f4b68f

Browse files
committed
MAGE-938 Add getStoreIds method
1 parent 1996233 commit 3f4b68f

File tree

3 files changed

+8
-5
lines changed

3 files changed

+8
-5
lines changed

Console/Command/AbstractReplicaCommand.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
use Magento\Framework\Exception\LocalizedException;
88
use Symfony\Component\Console\Command\Command;
99
use Symfony\Component\Console\Input\InputArgument;
10+
use Symfony\Component\Console\Input\InputInterface;
1011

1112
abstract class AbstractReplicaCommand extends Command
1213
{
@@ -65,4 +66,9 @@ protected function setAreaCode(): void
6566
}
6667
}
6768

69+
protected function getStoreIds(InputInterface $input): array
70+
{
71+
return (array) $input->getArgument(self::STORE_ARGUMENT);
72+
}
73+
6874
}

Console/Command/ReplicaDeleteCommand.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,6 @@
1818

1919
class ReplicaDeleteCommand extends AbstractReplicaCommand
2020
{
21-
protected const STORE_ARGUMENT = 'store';
22-
2321
protected const UNUSED_OPTION = 'unused';
2422
protected const UNUSED_OPTION_SHORTCUT = 'u';
2523

@@ -70,7 +68,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int
7068
$this->output = $output;
7169
$this->input = $input;
7270

73-
$storeIds = (array) $input->getArgument(self::STORE_ARGUMENT);
71+
$storeIds = $this->getStoreIds($input);
7472
$unused = $input->getOption(self::UNUSED_OPTION);
7573

7674
$msg = 'Deleting' . ($unused ? ' unused ' : ' ') . 'replicas for ' . ($storeIds ? count($storeIds) : 'all') . ' store' . (!$storeIds || count($storeIds) > 1 ? 's' : '');

Console/Command/ReplicaSyncCommand.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int
7070
$this->output = $output;
7171
$this->setAreaCode();
7272

73-
$storeIds = (array) $input->getArgument(self::STORE_ARGUMENT);
73+
$storeIds = $this->getStoreIds($input);
7474

7575
$msg = 'Syncing replicas for ' . ($storeIds ? count($storeIds) : 'all') . ' store' . (!$storeIds || count($storeIds) > 1 ? 's' : '');
7676
if ($storeIds) {
@@ -79,7 +79,6 @@ protected function execute(InputInterface $input, OutputInterface $output): int
7979
$output->writeln("<info>$msg</info>");
8080
}
8181

82-
8382
try {
8483
$this->syncReplicas($storeIds);
8584
} catch (BadRequestException) {

0 commit comments

Comments
 (0)