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
namespace App\Event\Subscriber;
use JMS\Serializer\EventDispatcher\Event;
use JMS\Serializer\EventDispatcher\Events;
use JMS\Serializer\EventDispatcher\EventSubscriberInterface;
use JMS\Serializer\EventDispatcher\PreSerializeEvent;
class SerializerSubscriber implements EventSubscriberInterface
{
public static function getSubscribedEvents()
{
return array(
array(
'event' => Events::PRE_SERIALIZE,
'method' => 'onPreSerialize',
'format' => 'json', // optional format
'priority' => 0, // optional priority
),
);
}
public function onPreSerialize(PreSerializeEvent $event)
{
$test = 1;
}
}
It does seem to get registered as subscriber in "RegisterEventListenersAndSubscribersPass"
When it actually gets built via 'SerializerBuilder::build' $this->listenersConfigured is set to false (But I am not sure if I am looking at the right place)..
Does anyone have any idea please?
The text was updated successfully, but these errors were encountered:
Hi I don't seem to be able to get the event subscriber working...
I am using Symfony 4.1 and JMS Serializer 3.1
Below is what I have in /config/services.yaml
And below is my subscriber.
It does seem to get registered as subscriber in "RegisterEventListenersAndSubscribersPass"
When it actually gets built via 'SerializerBuilder::build' $this->listenersConfigured is set to false (But I am not sure if I am looking at the right place)..
Does anyone have any idea please?
The text was updated successfully, but these errors were encountered: