public function consultarTipoPeriodoJSONAction() { $tipoPeriodoDao = new TipoPeriodoDao($this->getDoctrine()); $tipoPeriodo = $tipoPeriodoDao->getTipoPeriodo(); $numfilas = count($tipoPeriodo); $aux = new TipoPeriodo(); $i = 0; foreach ($tipoPeriodo as $aux) { $rows[$i]['id'] = $aux->getIdTipPer(); $rows[$i]['cell'] = array($aux->getIdTipPer(), $aux->getNomTipPer(), $aux->getActivoTipPer(), $aux->getDescTipPer()); if ($aux->getActivoTipPer()) { $rows[$i]['cell'][2] = 'SI'; } else { $rows[$i]['cell'][2] = 'NO'; } $i++; } $datos = json_encode($rows); $jsonresponse = '{ "page":"1", "total":"1", "records":"' . $numfilas . '", "rows":' . $datos . '}'; $response = new Response($jsonresponse); return $response; }