Skip to content

Commit

Permalink
Use Doctrine ClassUtils instead of direct proxy check.
Browse files Browse the repository at this point in the history
  • Loading branch information
BusterNeece committed Jun 12, 2022
1 parent f322c22 commit 4cfa9d0
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions src/DoctrineEntityNormalizer.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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)) {
Expand Down

0 comments on commit 4cfa9d0

Please sign in to comment.