Skip to content

Commit 6bcb755

Browse files
Fix clear command, checking return status code (#13)
* Fix clear command, checking return status code * Fixing import related to meilisearch-php ^0.12 Co-authored-by: david <[email protected]>
1 parent 264e78e commit 6bcb755

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

src/Command/MeiliSearchClearCommand.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,12 +33,12 @@ protected function execute(InputInterface $input, OutputInterface $output): int
3333
foreach ($indexToClear as $indexName => $entity) {
3434
$className = $entity['name'];
3535
$array = $this->searchService->clear($className);
36-
if ('processed' === $array['status']) {
36+
if ('failed' === $array['status']) {
37+
$output->writeln('<error>Index <info>'.$indexName.'</info> couldn\'t be cleared</error>');
38+
} else {
3739
$output->writeln(
3840
'Cleared <info>'.$indexName.'</info> index of <comment>'.$className.'</comment> '
3941
);
40-
} else {
41-
$output->writeln('<error>Index <info>'.$indexName.'</info> couldn\'t be cleared</error>');
4242
}
4343
}
4444

tests/TestCase/CommandsTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@
1313
use MeiliSearch\Bundle\Test\Entity\ContentAggregator;
1414
use MeiliSearch\Bundle\Test\Entity\Post;
1515
use MeiliSearch\Client;
16+
use MeiliSearch\Endpoints\Indexes;
1617
use MeiliSearch\Exceptions\HTTPRequestException;
17-
use MeiliSearch\Index;
1818
use Symfony\Bundle\FrameworkBundle\Console\Application;
1919
use Symfony\Component\Console\Tester\CommandTester;
2020

@@ -47,7 +47,7 @@ class CommandsTest extends BaseTest
4747
/** @var AbstractPlatform|null $platform */
4848
protected $platform;
4949

50-
/** @var Index $index */
50+
/** @var Indexes $index */
5151
protected $index;
5252

5353
/**

0 commit comments

Comments
 (0)