private function getPublishedPackage() { if (NULL === $this->publishedPackage) { $db = new DbDatabase(); $t = $db->getTournamentByTextId($this->getPublishedTextId()); if ($t) { $this->publishedPackage = DbPackage::newFromRow($t); } else { $this->publishedPackage = FALSE; } } return $this->publishedPackage; }
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(); }