public function addRol($nombreRol, $funciones) { $rolSistema = new RolSistema(); $rolSistema->setNombreRol($nombreRol); $rolSistema->setFuncionesRol($funciones); $this->em->persist($rolSistema); $this->em->flush(); $matrizMensajes = array('El proceso de almacenar rol termino con exito', 'Rol ' . $rolSistema->getIdRol()); return $matrizMensajes; }
public function consultarRolesAction() { $opciones = $this->getRequest()->getSession()->get('opciones'); $rolDao = new RolDao($this->getDoctrine()); $roles = $rolDao->getRoles(); $numfilas = count($roles); $rol = new RolSistema(); $i = 0; foreach ($roles as $rol) { $rows[$i]['id'] = $rol->getIdRol(); $rows[$i]['cell'] = array($rol->getIdRol(), $rol->getNombreRol(), $rol->getFuncionesRol()); $i++; } $datos = json_encode($rows); $jsonresponse = '{ "page":"1", "total":"1", "records":"' . $numfilas . '", "rows":' . $datos . '}'; $response = new Response($jsonresponse); return $response; /*return $this->render('MinSalSidPlaAdminBundle:Roles:showAllRoles.html.twig', array('roles' => $roles, 'opciones' => $opciones,));*/ }