Example #1
0
 public function save()
 {
     $db = new DbDatabase();
     $t = $db->getTournamentByTextId($this->getId());
     if ($t) {
         $db->updateTournament($this->tour);
         foreach ((array) $t as $k => $v) {
             if (!isset($this->tour->{$k})) {
                 $this->tour->{$k} = $v;
             }
         }
     } else {
         $this->tour->Id = $db->addTournament($this->tour);
     }
     $this->setId();
 }