I'm trying to deserialize an entity from a JSON file with this method
public function importAnnotationAction($id_rendu)
{
$em = $this->getDoctrine()->getEntityManager();
$jsonContent = $this->get("request")->getContent();
$serializer = $this->get('serializer');
$annotationEntity = $serializer->deserialize($jsonContent, 'Alecsia\AnnotationBundle\Entity\Annotation', 'json');
//Save entity
$em->persist($annotationEntity);
$em->flush();
return new Response($jsonContent . "\n" . var_dump($annotationEntity));
}
the JSON file used is from a same entity
and the output entity fields are all set to null :
object(Alecsia\AnnotationBundle\Entity\Annotation)#568 (18) { ["id":protected]=> int(26) ["fichier":protected]=> NULL ["rendu":protected]=> NULL ["modele":protected]=> NULL ["debut_ligne":protected]=> int(0) ["debut_col":protected]=> int(0) ["fin_ligne":protected]=> int(0) ["fin_col":protected]=> int(0) ["nom":protected]=> NULL ["commentaire":protected]=> NULL ["valeur":protected]=> NULL ["relatif":protected]=> NULL ["exercice":protected]=> NULL ["deleguer_nom":protected]=> bool(false) ["deleguer_commentaire":protected]=> bool(false) ["deleguer_valeur":protected]=> bool(false) ["deleguer_relatif":protected]=> bool(false) ["deleguer_exercice":protected]=> bool(false) }
and the entity id increment with each call, what am I doind wrong?