You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I've been banging my head to write a simple subscriber for JMS Serializer for 2 days. Finally, after trying many syntaxes unsuccessfully I found vendor/jms/serializer/src/JMS/Serializer/EventDispatcher/Subscriber/DoctrineProxySubscriber.php and just copy pasted it... and still didn't work.
My subscriber reads like this:
<?php
namespace License\StudentBundle\EventListener;
use Doctrine\ORM\PersistentCollection;
use Doctrine\Common\Persistence\Proxy;
use Doctrine\ORM\Proxy\Proxy as ORMProxy;
use JMS\Serializer\EventDispatcher\PreSerializeEvent;
use JMS\Serializer\EventDispatcher\EventSubscriberInterface;
class ProgenitorSerializationSubscriber implements EventSubscriberInterface
{
public function onPreSerialize(PreSerializeEvent $event)
{
throw new \Exception("Preserializiiiiing");
}
public static function getSubscribedEvents()
{
return array(
array('event' => 'serializer.pre_serialize', 'method' => 'onPreSerialize'),
);
}
}
and it doesn't work. But if I just move it to the vendor/jms/serializer/src/JMS/Serializer/EventDispatcher/Subscriber folder a rename its namespace to namespace License\StudentBundle\EventListener; it works! (or rather doesn't because it throws an exception, haha)
Anyways... WTH? What's going on (or rather isn't going on) behind the scenes? How do I make it work?
The text was updated successfully, but these errors were encountered:
I've been banging my head to write a simple subscriber for JMS Serializer for 2 days. Finally, after trying many syntaxes unsuccessfully I found vendor/jms/serializer/src/JMS/Serializer/EventDispatcher/Subscriber/DoctrineProxySubscriber.php and just copy pasted it... and still didn't work.
My subscriber reads like this:
and it doesn't work. But if I just move it to the vendor/jms/serializer/src/JMS/Serializer/EventDispatcher/Subscriber folder a rename its namespace to namespace License\StudentBundle\EventListener; it works! (or rather doesn't because it throws an exception, haha)
Anyways... WTH? What's going on (or rather isn't going on) behind the scenes? How do I make it work?
The text was updated successfully, but these errors were encountered: