diff --git a/Listener/IndexSubscriber.php b/Listener/IndexSubscriber.php index 526a380..b13bdc8 100644 --- a/Listener/IndexSubscriber.php +++ b/Listener/IndexSubscriber.php @@ -107,8 +107,9 @@ public function postFlush(PostFlushEventArgs $ea) */ private function scheduleForIndexation($entity) { - if ($this->isManaged($entity) && !in_array($entity, $this->scheduledIndexations)) { - $this->scheduledIndexations[] = $entity; + $entityHash = spl_object_hash($entity); + if ($this->isManaged($entity) && !isset($this->scheduledIndexations[$entityHash])) { + $this->scheduledIndexations[$entityHash] = $entity; } } @@ -119,8 +120,9 @@ private function scheduleForIndexation($entity) */ private function scheduleForUnindexation($entity) { - if ($this->isManaged($entity) && !in_array($entity, $this->scheduledUnindexations)) { - $this->scheduledUnindexations[]= $entity; + $entityHash = spl_object_hash($entity); + if ($this->isManaged($entity) && !isset($this->scheduledUnindexations[$entityHash])) { + $this->scheduledUnindexations[$entityHash] = $entity; } } @@ -149,4 +151,4 @@ private function isManaged($entity) return $managed; } -} \ No newline at end of file +}