public function getEtapasAction() { $user = $this->get('security.context')->getToken()->getUser(); $solImportacionDao = new SolImportacionDao($this->getDoctrine()); $roles = $user->getRols(); $traIdSeries = array(); $registros = array(); $entId = 0; $result = array(); if ($user->getEntidad()) { $entId = $user->getEntidad()->getEntId(); } foreach ($roles as $rol) { $transiciones = $rol->getTransiciones(); foreach ($transiciones as $transicion) { foreach ($transicion->getParentsTransicion() as $reg) { if ($reg->getFlujo()->getFluId() == Flujo::$IMPORTACION && !array_key_exists($reg->getEtpFin()->getEtpId(), $traIdSeries)) { //$tmpIndex)){ $tmp['traId'] = $reg->getTraId(); $tmp['id'] = $reg->getEtpFin()->getEtpId(); $tmp['nombre'] = $reg->getEtpFin()->getEtpNombre(); $tmp['cantidad'] = $solImportacionDao->getCantidadSolicitudesXEtapa($entId, $reg->getEtpFin()->getEtpId()); //$tmpIndex[$reg->getEtpFin()->getEtpId()] = true; $traIdSeries[$tmp['id']] = $tmp; } } } foreach ($traIdSeries as $etapa) { $result[$etapa['traId']] = $etapa; } } $registros['registros'] = $result; $datos = json_encode($registros); $response = new Response($datos); $response->headers->set('Content-Type', 'application/json'); return $response; }