jmsserializerbundle
Add extra fields using JMS Serializer bundle
I’ve found the solution by myself, to add a custom field after the serialization has been done we’ve to create a listener class like this: <?php namespace Acme\DemoBundle\Listener; use JMS\DiExtraBundle\Annotation\Service; use JMS\DiExtraBundle\Annotation\Tag; use JMS\DiExtraBundle\Annotation\Inject; use JMS\DiExtraBundle\Annotation\InjectParams; use Symfony\Component\HttpKernel\Event\PostResponseEvent; use Acme\DemoBundle\Entity\Team; use JMS\Serializer\Handler\SubscribingHandlerInterface; use JMS\Serializer\EventDispatcher\EventSubscriberInterface; use JMS\Serializer\EventDispatcher\PreSerializeEvent; use JMS\Serializer\EventDispatcher\ObjectEvent; use JMS\Serializer\GraphNavigator; use JMS\Serializer\JsonSerializationVisitor; /** * Add … Read more
How to create a good hypermedia format using JMSSerializerBundle?
The Serializer Bundle alone might not be enough for this situation as it is only concerned with serialization and deserialization, not more complex semantical tasks. I would suggest looking into FSCHateoasBundle to implement a pretty hypermedia format for your API.
How to create a good hypermedia format using JMSSerializerBundle?
The Serializer Bundle alone might not be enough for this situation as it is only concerned with serialization and deserialization, not more complex semantical tasks. I would suggest looking into FSCHateoasBundle to implement a pretty hypermedia format for your API.