From 633b91c531e5ef4052e5e89e86d7dff0e44b46bb Mon Sep 17 00:00:00 2001 From: floriansemm Date: Thu, 15 Nov 2018 10:20:22 +0100 Subject: [PATCH] hotfix: catch exception if no document-declaration was found in normal entity --- .../ORM/Listener/EntityIndexerSubscriber.php | 27 +++++++++++-------- 1 file changed, 16 insertions(+), 11 deletions(-) diff --git a/Doctrine/ORM/Listener/EntityIndexerSubscriber.php b/Doctrine/ORM/Listener/EntityIndexerSubscriber.php index 660e7ed4..7d08c6e5 100644 --- a/Doctrine/ORM/Listener/EntityIndexerSubscriber.php +++ b/Doctrine/ORM/Listener/EntityIndexerSubscriber.php @@ -96,19 +96,24 @@ private function emptyCollections($object) */ public function postFlush(PostFlushEventArgs $eventArgs) { - foreach ($this->persistedEntities as $entity) { - $this->solr->addDocument($entity); - } - $this->persistedEntities = []; + try { - foreach ($this->deletedRootEntities as $entity) { - $this->solr->removeDocument($entity); - } - $this->deletedRootEntities = []; + foreach ($this->persistedEntities as $entity) { + $this->solr->addDocument($entity); + } + $this->persistedEntities = []; - foreach ($this->deletedNestedEntities as $entity) { - $this->solr->removeDocument($entity); + foreach ($this->deletedRootEntities as $entity) { + $this->solr->removeDocument($entity); + } + $this->deletedRootEntities = []; + + foreach ($this->deletedNestedEntities as $entity) { + $this->solr->removeDocument($entity); + } + $this->deletedNestedEntities = []; + } catch (\Exception $e) { + $this->logger->debug($e->getMessage()); } - $this->deletedNestedEntities = []; } } \ No newline at end of file