|
@@ -2,6 +2,7 @@
|
|
|
|
|
|
namespace JMS\SerializerBundle\Serializer\EventDispatcher\Subscriber;
|
|
|
|
|
|
+use Doctrine\ORM\PersistentCollection;
|
|
|
use Doctrine\Common\Persistence\Proxy;
|
|
|
use Doctrine\ORM\Proxy\Proxy as ORMProxy;
|
|
|
use JMS\SerializerBundle\Serializer\EventDispatcher\PreSerializeEvent;
|
|
@@ -13,6 +14,12 @@ class DoctrineProxySubscriber implements EventSubscriberInterface
|
|
|
{
|
|
|
$object = $event->getObject();
|
|
|
|
|
|
+ if ($object instanceof PersistentCollection) {
|
|
|
+ $event->setType('ArrayCollection');
|
|
|
+
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
if ( ! $object instanceof Proxy && ! $object instanceof ORMProxy) {
|
|
|
return;
|
|
|
}
|