|
24 | 24 | use ApiPlatform\Metadata\ResourceClassResolverInterface;
|
25 | 25 | use ApiPlatform\Metadata\UrlGeneratorInterface;
|
26 | 26 | use ApiPlatform\Metadata\Util\ClassInfoTrait;
|
27 |
| -use Doctrine\Common\Util\ClassUtils; |
28 | 27 | use Doctrine\ORM\EntityManagerInterface;
|
29 | 28 | use Doctrine\ORM\Event\OnFlushEventArgs;
|
30 | 29 | use Doctrine\ORM\Event\PreUpdateEventArgs;
|
@@ -60,7 +59,7 @@ public function preUpdate(PreUpdateEventArgs $eventArgs): void
|
60 | 59 | $changeSet = $eventArgs->getEntityChangeSet();
|
61 | 60 | // @phpstan-ignore-next-line
|
62 | 61 | $objectManager = method_exists($eventArgs, 'getObjectManager') ? $eventArgs->getObjectManager() : $eventArgs->getEntityManager();
|
63 |
| - $associationMappings = $objectManager->getClassMetadata(ClassUtils::getClass($eventArgs->getObject()))->getAssociationMappings(); |
| 62 | + $associationMappings = $objectManager->getClassMetadata(\get_class($eventArgs->getObject()))->getAssociationMappings(); |
64 | 63 |
|
65 | 64 | foreach ($changeSet as $key => $value) {
|
66 | 65 | if (!isset($associationMappings[$key])) {
|
@@ -127,7 +126,7 @@ private function gatherResourceAndItemTags(object $entity, bool $purgeItem): voi
|
127 | 126 |
|
128 | 127 | private function gatherRelationTags(EntityManagerInterface $em, object $entity): void
|
129 | 128 | {
|
130 |
| - $associationMappings = $em->getClassMetadata(ClassUtils::getClass($entity))->getAssociationMappings(); |
| 129 | + $associationMappings = $em->getClassMetadata($entity::class)->getAssociationMappings(); |
131 | 130 | /** @var array|AssociationMapping $associationMapping according to the version of doctrine orm */
|
132 | 131 | foreach ($associationMappings as $property => $associationMapping) {
|
133 | 132 | if ($associationMapping instanceof AssociationMapping && ($associationMapping->targetEntity ?? null) && !$this->resourceClassResolver->isResourceClass($associationMapping->targetEntity)) {
|
|
0 commit comments