From 4cfa9d03f049e38991bb2dddaf291c2a6390bf22 Mon Sep 17 00:00:00 2001 From: "Buster \"Silver Eagle\" Neece" Date: Sun, 12 Jun 2022 09:29:46 -0500 Subject: [PATCH] Use Doctrine ClassUtils instead of direct proxy check. --- src/DoctrineEntityNormalizer.php | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/DoctrineEntityNormalizer.php b/src/DoctrineEntityNormalizer.php index 45ca5b5..cf6038c 100644 --- a/src/DoctrineEntityNormalizer.php +++ b/src/DoctrineEntityNormalizer.php @@ -5,10 +5,10 @@ use Azura\Normalizer\Exception\NoGetterAvailableException; use Azura\Normalizer\Attributes\DeepNormalize; use Doctrine\Common\Collections\Collection; +use Doctrine\Common\Util\ClassUtils; use Doctrine\Inflector\Inflector; use Doctrine\Inflector\InflectorFactory; use Doctrine\ORM\EntityManagerInterface; -use Doctrine\Persistence\Proxy; use ReflectionClass; use ReflectionProperty; use Symfony\Component\Serializer\Mapping\Factory\ClassMetadataFactoryInterface; @@ -361,9 +361,7 @@ protected function setProperty(object $entity, string $key, mixed $value): void protected function isEntity(mixed $class): bool { if (is_object($class)) { - $class = ($class instanceof Proxy) - ? get_parent_class($class) - : get_class($class); + $class = ClassUtils::getClass($class); } if (!is_string($class) || !class_exists($class)) {