public function consultarObjInstJSONAction() { $ObjetivoDao = new ObjetivosInstitucionalesDao($this->getDoctrine()); $ObjetivosT = $ObjetivoDao->getObjInst(); $numfilas = count($ObjetivosT); $uni = new ObjetivosInstitucionales(); $i = 0; foreach ($ObjetivosT as $uni) { $rows[$i]['id'] = $uni->getIdobjInst(); $rows[$i]['cell'] = array($uni->getIdobjInst(), $uni->getObjInstObjetivo()); $i++; } $datos = json_encode($rows); $jsonresponse = '{ "page":"1", "total":"1", "records":"' . $numfilas . '", "rows":' . $datos . '}'; $response = new Response($jsonresponse); return $response; }