Skip to content

Commit

Permalink
Get real class name
Browse files Browse the repository at this point in the history
  • Loading branch information
dzubchik committed May 30, 2017
1 parent d5eb43c commit dfd264a
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/ContainerAwareManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
}
Expand Down

0 comments on commit dfd264a

Please sign in to comment.