Basically I want to deserialize json to user object. Like this
$serializer = $this->get('jms_serializer');
$data = $serializer->deserialize($this->get('request')->getContent(),
'My\FooBundle\Entity\User', 'json');
The request data passed to deserializer:
{"id":2,"username":"...@gmail.com","username_canonical":"...@gmail.com", ... }
Thrown error:
request.CRITICAL: Uncaught PHP Exception JMS\Serializer\Exception\RuntimeException: "You must define a type for FOS\UserBundle\Model\User::$username." at ...\vendor\jms\serializer\src\JMS\Serializer\GenericDeserializationVisitor.php line 170 [] []
I use sf 2.3. Is there anything that has to be setup for deserialization of fos user class? Any idea why I get this message and how to fix it?