From 2445144c87f7e5ec510354612dbd556d8bafb7cf Mon Sep 17 00:00:00 2001 From: Maxime Huran Date: Fri, 11 Aug 2023 16:06:29 +0200 Subject: [PATCH] Use DTO ID to be able to have custom IDs --- src/Index/Indexer.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Index/Indexer.php b/src/Index/Indexer.php index d5343d99..aa1f2967 100644 --- a/src/Index/Indexer.php +++ b/src/Index/Indexer.php @@ -94,7 +94,7 @@ public function indexByDocuments(DocumentableInterface $documentable, array $doc } $dto = $this->autoMapper->map($document, $documentable->getTargetClass()); // @phpstan-ignore-next-line - $indexer->scheduleIndex($index, new Document((string) $document->getId(), $dto)); + $indexer->scheduleIndex($index, new Document((string) $dto->getId(), $dto)); } } @@ -184,7 +184,7 @@ private function indexDocumentable(OutputInterface $output, DocumentableInterfac } $dto = $this->autoMapper->map($item, $documentable->getTargetClass()); // @phpstan-ignore-next-line - $indexer->scheduleIndex($newIndex, new Document((string) $item->getId(), $dto)); + $indexer->scheduleIndex($newIndex, new Document((string) $dto->getId(), $dto)); } $indexer->flush();