I call a controller from my view:
/**
* Flush new chat message.
*
* @Route("/commande/returnMsg", name="new_chat_msg_print", options={"expose"=true})
*/
public function ajaxReturnListAction(Request $request)
{
$repository = $this->getDoctrine()
->getManager()
->getRepository('MyAwesomeBundle:Chat');
$listeMsg = $repository->findAll();
return new Response(json_encode($listeMsg), 200);
}
In the "Chat" Entity, I have 4 fields. But the controller return an empty json result...
[{},{},{},{},{},{},{}]
I don't know how to get the data and return them into json...
Thanks for help !