Skip to content

Commit

Permalink
Fix PHP CS
Browse files Browse the repository at this point in the history
  • Loading branch information
maximehuran committed Jun 7, 2022
1 parent 448cb74 commit 087c288
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions src/Index/Indexer.php
Original file line number Diff line number Diff line change
Expand Up @@ -171,11 +171,13 @@ private function getIndexName(DocumentableInterface $documentable, ?string $loca
}

/**
* Convert proxies classes to the entity one
*
* Convert proxies classes to the entity one.
*
* This avoid to retrieve the incorrect Mapper and have errors like :
* `index: /<INDEX_NAME>/_doc/<ID> caused failed to parse`
*
*
* @param mixed $entity
*
* @return mixed
*/
private function getRealEntity($entity)
Expand All @@ -185,9 +187,9 @@ private function getRealEntity($entity)
}

// Clear the entity manager to detach the proxy object
$this->entityManager->clear(get_class($entity));
$this->entityManager->clear(\get_class($entity));
// Retrieve the original class name
$entityClassName = $this->entityManager->getClassMetadata(get_class($entity))->rootEntityName;
$entityClassName = $this->entityManager->getClassMetadata(\get_class($entity))->rootEntityName;
// Find the object in repository from the ID
return $this->entityManager->find($entityClassName, $entity->getId());
}
Expand Down

0 comments on commit 087c288

Please sign in to comment.