我需要帮助将查询列表发送到没有标题的Twig。我已经查询了我的数据而且卡住了。我必须以JSON结构获得这些数据。
这是我的root名称:'AdminBundle:注意:viewPdf.html.twig' 这里是推进中的查询类的名称 - 它现在是空的:MnNoteCommentQuery。
这是我的代码:
$noteQuery = MnNoteCommentQuery::create()->find();
$responsed = new JSonResponse($noteQuery);
return $this->render('AdminBundle:Note:viewPdf.html.twig', array('notes' => $responsed));
答案 0 :(得分:1)
只需在树枝中使用json_encode
Process.Start("File.exe");
嫩枝:
return $this->render('AdminBundle:Note:viewPdf.html.twig', array('notes' => $notes));
您可以通过实现JsonSerializable接口
来自定义json表示