Skip to content

Commit 5c72f1d

Browse files
committed
Fix the purge cache listener
1 parent f3a4016 commit 5c72f1d

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/Doctrine/EventListener/PurgeHttpCacheListener.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ public function preUpdate(PreUpdateEventArgs $eventArgs): void
5959
$changeSet = $eventArgs->getEntityChangeSet();
6060
// @phpstan-ignore-next-line
6161
$objectManager = method_exists($eventArgs, 'getObjectManager') ? $eventArgs->getObjectManager() : $eventArgs->getEntityManager();
62-
$associationMappings = $objectManager->getClassMetadata(get_class($eventArgs->getObject())->getAssociationMappings();
62+
$associationMappings = $objectManager->getClassMetadata(get_class($eventArgs->getObject()))->getAssociationMappings();
6363

6464
foreach ($changeSet as $key => $value) {
6565
if (!isset($associationMappings[$key])) {
@@ -126,7 +126,7 @@ private function gatherResourceAndItemTags(object $entity, bool $purgeItem): voi
126126

127127
private function gatherRelationTags(EntityManagerInterface $em, object $entity): void
128128
{
129-
$associationMappings = $em->getClassMetadata($em->getClassMetadata(get_class($entity))->getName())->getAssociationMappings();
129+
$associationMappings = $em->getClassMetadata(get_class($entity))->getAssociationMappings();
130130
/** @var array|AssociationMapping $associationMapping according to the version of doctrine orm */
131131
foreach ($associationMappings as $property => $associationMapping) {
132132
if ($associationMapping instanceof AssociationMapping && ($associationMapping->targetEntity ?? null) && !$this->resourceClassResolver->isResourceClass($associationMapping->targetEntity)) {

0 commit comments

Comments
 (0)