From 6d10ceb64952f753bde055709e2c0dca6e1c8f8e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?K=C3=A9vin=20Dunglas?= Date: Mon, 3 Apr 2017 15:35:39 +0200 Subject: [PATCH] Always use ClassUtils to guess the class name (prevent proxy related issues) --- src/Normalizer/ObjectNormalizer.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/Normalizer/ObjectNormalizer.php b/src/Normalizer/ObjectNormalizer.php index a4ab665..245c7cc 100644 --- a/src/Normalizer/ObjectNormalizer.php +++ b/src/Normalizer/ObjectNormalizer.php @@ -9,6 +9,7 @@ namespace Dunglas\DoctrineJsonOdm\Normalizer; +use Doctrine\Common\Util\ClassUtils; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; use Symfony\Component\Serializer\SerializerAwareInterface; @@ -43,7 +44,7 @@ public function __construct(NormalizerInterface $objectNormalizer) */ public function normalize($object, $format = null, array $context = []) { - return array_merge(['#type' => get_class($object)], $this->objectNormalizer->normalize($object, $format, $context)); + return array_merge(['#type' => ClassUtils::getClass($object)], $this->objectNormalizer->normalize($object, $format, $context)); } /**