Skip to content

Commit

Permalink
NGSTACK-836: fix CS
Browse files Browse the repository at this point in the history
  • Loading branch information
pspanja committed May 29, 2024
1 parent c0287a8 commit 5ff522e
Showing 1 changed file with 5 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@

namespace Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\ParentChildIndexing\Content;

use Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\ParentChildIndexing\AncestorIndexer;
use Ibexa\Contracts\Core\Persistence\Content\Location\Handler as LocationHandler;
use Ibexa\Contracts\Core\Repository\Exceptions\NotFoundException;
use Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\Message\Search\Content\DeleteContent;
use Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\ParentChildIndexing\AncestorIndexer;
use Psr\Log\LoggerInterface;
use Psr\Log\NullLogger;

Expand All @@ -23,7 +23,7 @@ public function __construct(

public function __invoke(DeleteContent $message): void
{
if ($message->parentLocationIds === []) {
if (count($message->parentLocationIds) === 0) {
$this->logger->info(
sprintf(
'%s: Could not find main Location parent Location ID for deleted Content #%d, aborting',
Expand All @@ -34,7 +34,9 @@ public function __invoke(DeleteContent $message): void

return;
}

$locations = [];

foreach ($message->parentLocationIds as $locationId) {
try {
$locations[] = $this->locationHandler->load($locationId);
Expand All @@ -48,6 +50,7 @@ public function __invoke(DeleteContent $message): void
);
}
}

$this->ancestorIndexer->indexMultipleForParentLocation($locations);
}
}

0 comments on commit 5ff522e

Please sign in to comment.