I would like to map a json string to my entity Poste.
Here is my json output with var_dump :
string(695) "{
"id":2,
"user": {
"id":1,
"username":"tom.smith",
"email":"tom.smith@gmail.com"
// other properties of User class (FOSUserBundle)
},
"description":"cool",
"nb_comments":0,"nb_likes":0,
"date_creation":"2014-04-13T20:07:34-0700",
"is_there_fashtag":false,
"fashtags":[]
}"
I tried to deserialize with jmsserializer :
$postes[] = $serializer->deserialize($value, 'Moodress\Bundle\PosteBundle\Entity\Poste', 'json');
I have an error :
Catchable Fatal Error: Argument 1 passed to
Moodress\Bundle\PosteBundle\Entity\Poste::setUser() must be an instance of
Moodress\Bundle\UserBundle\Entity\User, array given
Why am I not able to deserialize a simple entity poste ?
Thanks