Skip to content

Commit 23637db

Browse files
committed
MAGE-938 Inject ReplicaManager
1 parent 6676ab9 commit 23637db

File tree

1 file changed

+18
-4
lines changed

1 file changed

+18
-4
lines changed

Console/Command/ReplicaCommand.php

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,29 @@
22

33
namespace Algolia\AlgoliaSearch\Console\Command;
44

5+
use Algolia\AlgoliaSearch\Api\Product\ReplicaManagerInterface;
56
use Magento\Framework\Console\Cli;
67
use Symfony\Component\Console\Command\Command;
78
use Symfony\Component\Console\Input\InputInterface;
8-
use Symfony\Component\Console\Input\InputOption;
99
use Symfony\Component\Console\Input\InputArgument;
1010
use Symfony\Component\Console\Output\OutputInterface;
1111

1212
class ReplicaCommand extends Command
1313
{
1414
const STORE_ARGUMENT = 'store';
1515

16+
/**
17+
* @param ReplicaManagerInterface $replicaManager
18+
* @param string|null $name
19+
*/
20+
public function __construct(
21+
protected ReplicaManagerInterface $replicaManager,
22+
?string $name = null
23+
)
24+
{
25+
parent::__construct($name);
26+
}
27+
1628
/**
1729
* @inheritDoc
1830
*/
@@ -30,14 +42,16 @@ protected function configure(): void
3042
/** @inheritDoc */
3143
protected function execute(InputInterface $input, OutputInterface $output): int
3244
{
33-
$name = $input->getArgument(self::STORE_ARGUMENT);
45+
$storeIds = $input->getArgument(self::STORE_ARGUMENT);
3446

35-
if ($name) {
36-
$output->writeln('<info>Syncing store ' . $name . '!</info>');
47+
if ($storeIds) {
48+
$output->writeln('<info>Syncing store ' . $storeIds . '!</info>');
3749
} else {
3850
$output->writeln('<info>Syncing all stores</info>');
3951
}
4052

53+
// $this->replicaManager->syncReplicasToAlgolia();
54+
4155
return Cli::RETURN_SUCCESS;
4256
}
4357
}

0 commit comments

Comments
 (0)