/** * Delete route */ protected function deleteRoute() { if ($this->Object->get(Model\Activity\Object::ROUTEID) > 0) { // TODO: check if route was uniquely used // For the moment, routes are created uniquely, so that's right. $Deleter = new Model\Route\Deleter($this->PDO, new Model\Route\Object(array('id' => $this->Object->get(Model\Activity\Object::ROUTEID)))); $Deleter->setAccountID($this->AccountID); $Deleter->delete(); } }
/** * Save changes for route */ protected function saveChangesForRoute() { if (null === $this->Route || $this->OldRoute->isEmpty()) { return; } $this->Route->synchronize(); if ($this->Route->isEmpty()) { $Deleter = new Model\Route\Deleter($this->PDO, $this->Route); $Deleter->setAccountID($this->AccountID); $Deleter->delete(); $this->Route = null; $this->Activity->set(Entity::ROUTEID, 0); $this->Activity->set(Entity::ELEVATION, 0); } else { $Updater = new Model\Route\Updater($this->PDO, $this->Route, $this->OldRoute); $Updater->setAccountID($this->AccountID); $Updater->update(); } }