private function getDb()
 {
     if ($this->db !== null) {
         return $this->db;
     }
     try {
         $cfg = Configuracion::obtConfig("basedatos");
         $this->db = new PDO($cfg['dsn'], $cfg['user'], $cfg['password']);
     } catch (Exception $exc) {
         echo $exc->getTraceAsString();
     }
     return $this->db;
 }
 private function getDb()
 {
     if ($this->db !== null) {
         return $this->db;
     }
     try {
         $cfg = Configuracion::obtConfig("basedatos");
         $this->db = new PDO($cfg['dsn'], $cfg['user'], $cfg['password']);
         $this->db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
     } catch (Exception $exc) {
         throw new Exception("La base de datos no pudo ser creada." . $exc->getMessage());
     }
     return $this->db;
 }