Skip to content

Instantly share code, notes, and snippets.

View riley-van-hengstum's full-sized avatar

Riley van Hengstum riley-van-hengstum

View GitHub Profile
@riley-van-hengstum
riley-van-hengstum / DoctrineProxyHandler.php
Last active September 19, 2021 15:04
Disable lazy loading when serializing Doctrine 2 objects with JMS Serializer
namespace MyApp\ApiBundle\Serializer;
use JMS\Serializer\Context;
use JMS\Serializer\GraphNavigator;
use JMS\Serializer\Handler\SubscribingHandlerInterface;
use JMS\Serializer\VisitorInterface;
use JMS\Serializer\XmlSerializationVisitor;
class DoctrineProxyHandler implements SubscribingHandlerInterface
{