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
Hello,
I was trying to make a doctrine entity -> json conversion work with the Serializer bundle, I was following both http://symfony.com/doc/current/components/serializer.html and http://jmsyst.com/libs/serializer#usage . The code mentions several times this:
$serializer->serialize($person, 'json'); or more generally, this: $serializer->serialize($data, 'json'); .
It seems that in order for it to work, you need to
$avariable = $serializer->serialize($data, 'json'); and return that $avariable in the response.
I understand it might seem trivial for PHP-ers but as it's a guide for people starting up, why not add a line with the proper return response? (would save time:))
Thanks!
The text was updated successfully, but these errors were encountered:
Hello,
I was trying to make a doctrine entity -> json conversion work with the Serializer bundle, I was following both http://symfony.com/doc/current/components/serializer.html and http://jmsyst.com/libs/serializer#usage . The code mentions several times this:
$serializer->serialize($person, 'json'); or more generally, this: $serializer->serialize($data, 'json'); .
It seems that in order for it to work, you need to
$avariable = $serializer->serialize($data, 'json'); and return that $avariable in the response.
I understand it might seem trivial for PHP-ers but as it's a guide for people starting up, why not add a line with the proper return response? (would save time:))
Thanks!
The text was updated successfully, but these errors were encountered: