i'm getting a json response from mongodb, but i can't get this into a twig template. could somebody explain it and show best pratice? thanks.
/**
* @Route("/event/{id}", name="event_details_view")
* @Template()
*/
public function viewAction($id)
{
$event = $this->get('doctrine.odm.mongodb.document_manager')
->getRepository('DungeonEventBundle:Event')
->findById($id);
if (!$event) {
throw $this->createNotFoundException('Event .$id. was not found.');
}
return new Response(json_encode($event));
}