From dfd264a72b0725e080dc56ce744894b2c3b7ccee Mon Sep 17 00:00:00 2001 From: Dmytro Dzubenko Date: Tue, 30 May 2017 15:57:30 +0300 Subject: [PATCH] Get real class name --- src/ContainerAwareManager.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/ContainerAwareManager.php b/src/ContainerAwareManager.php index fe7882b..ec47905 100644 --- a/src/ContainerAwareManager.php +++ b/src/ContainerAwareManager.php @@ -2,6 +2,7 @@ namespace Paymaxi\FractalBundle; +use Doctrine\Common\Util\ClassUtils; use League\Fractal\Manager; use League\Fractal\Resource\Collection; use League\Fractal\Resource\Item; @@ -63,9 +64,9 @@ private function resolveTransformer(ResourceInterface $resource) $serviceRegistry = $this->container->get('fractal.transformer.resolvers'); if ($resource instanceof Item) { - $instance = get_class($resource->getData()); + $instance = ClassUtils::getRealClass(get_class($resource->getData())); } elseif ($resource instanceof Collection) { - $instance = get_class($resource->getData()[0]); + $instance = ClassUtils::getRealClass(get_class($resource->getData()[0])); } else { return; }