From 5ff522e08438aacc07822dbe9ef94d188c4fae44 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Petar=20=C5=A0panja?= Date: Wed, 29 May 2024 08:13:26 +0200 Subject: [PATCH] NGSTACK-836: fix CS --- .../ParentChildIndexing/Content/DeleteContentHandler.php | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/lib/Core/Search/Common/Messenger/MessageHandler/Search/ParentChildIndexing/Content/DeleteContentHandler.php b/lib/Core/Search/Common/Messenger/MessageHandler/Search/ParentChildIndexing/Content/DeleteContentHandler.php index c9b73be0..9e380d1e 100644 --- a/lib/Core/Search/Common/Messenger/MessageHandler/Search/ParentChildIndexing/Content/DeleteContentHandler.php +++ b/lib/Core/Search/Common/Messenger/MessageHandler/Search/ParentChildIndexing/Content/DeleteContentHandler.php @@ -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; @@ -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', @@ -34,7 +34,9 @@ public function __invoke(DeleteContent $message): void return; } + $locations = []; + foreach ($message->parentLocationIds as $locationId) { try { $locations[] = $this->locationHandler->load($locationId); @@ -48,6 +50,7 @@ public function __invoke(DeleteContent $message): void ); } } + $this->ancestorIndexer->indexMultipleForParentLocation($locations); } }