Ejemplo n.º 1
0
 /**
  * Ingresar
  *
  * @param GrupoDispoCabData $GrupoDispoCabData
  * @return array
  */
 function registrarPorAccion($accion, GrupoDispoCabData $GrupoDispoCabData)
 {
     $this->getEntityManager()->getConnection()->beginTransaction();
     try {
         $GrupoDispoCabDAO = new GrupoDispoCabDAO();
         $GrupoDispoCabDAO->setEntityManager($this->getEntityManager());
         switch ($accion) {
             case 'I':
                 $id = $GrupoDispoCabDAO->ingresar($GrupoDispoCabData);
                 $result['id'] = $id;
                 break;
             case 'M':
                 $id = $GrupoDispoCabDAO->modificar($GrupoDispoCabData);
                 $result['id'] = $id;
                 break;
         }
         //end switch
         $this->getEntityManager()->getConnection()->commit();
         return $result;
     } catch (Exception $e) {
         $this->getEntityManager()->getConnection()->rollback();
         $this->getEntityManager()->close();
         throw $e;
     }
 }