public function ingresarUnidadOrg($nombreUnidad, $direccion, $responsable, $telefono, $fax, $tipoUnidad, $unidadPadre, $departameto, $municipio, $descripcion)
 {
     $municipioDao = new MunicipioDao($this->doctrine);
     $muncipioObj = $municipioDao->getMunicipio($municipio);
     $informacionGeneral = new InformacionGeneral();
     $informacionGeneral->setDireccion($direccion);
     $informacionGeneral->setTelefono($telefono);
     $informacionGeneral->setFax($fax);
     $unidadOrg = new UnidadOrganizativa();
     $unidadOrg->setNombreUnidad($nombreUnidad);
     $unidadOrg->setTipoUnidad($tipoUnidad);
     if ($unidadPadre != 0) {
         $unidadParent = $this->repositorio->find($unidadPadre);
         $unidadOrg->setParent($unidadParent);
     }
     $unidadOrg->setIdMunicipio($municipio);
     $unidadOrg->setInformacionGeneral($informacionGeneral);
     $unidadOrg->setDescripcionUnidad($descripcion);
     $informacionGeneral->setUnidadOrganizativa($unidadOrg);
     $this->em->persist($unidadOrg);
     $this->em->persist($informacionGeneral);
     $this->em->flush();
     $matrizMensajes = array('El proceso de almacenar Unidad Organizativa termino con exito', 'Unidad ' . $unidadOrg->getIdUnidadOrg());
     return $matrizMensajes;
 }
 public function consultarUnidadesOrgJSONAction()
 {
     $unidadOrgDao = new UnidadOrganizativaDao($this->getDoctrine());
     $unidadesOrg = $unidadOrgDao->getUnidadesOrg();
     $numfilas = count($unidadesOrg);
     $uni = new UnidadOrganizativa();
     $i = 0;
     foreach ($unidadesOrg as $uni) {
         $infogeneral = $uni->getInformacionGeneral();
         if ($infogeneral == null) {
             $infogeneral = new InformacionGeneral();
         }
         $rows[$i]['id'] = $uni->getIdUnidadOrg();
         $rows[$i]['cell'] = array($uni->getIdUnidadOrg(), $uni->getNombreUnidad(), $uni->getDescripcionUnidad(), '', $infogeneral->getDireccion(), $infogeneral->getTelefono());
         $i++;
     }
     $datos = json_encode($rows);
     $jsonresponse = '{
            "page":"1",
            "total":"1",
            "records":"' . $numfilas . '", 
            "rows":' . $datos . '}';
     $response = new Response($jsonresponse);
     return $response;
 }