/** * Commit changes to database * @since Version 3.2 * @version 3.8.7 * @return boolean */ public function commit() { $timer = Debug::getTimer(); $this->validate(); $data = Utility\LocomotiveUtility::getSubmitData($this); if (!filter_var($this->id, FILTER_VALIDATE_INT)) { $rs = $this->db->insert("loco_unit", $data); $this->id = $this->db->lastInsertId(); $verb = "Insert"; } else { $this->Memcached->delete($this->mckey); $this->Redis->delete($this->mckey); $where = array("loco_id = ?" => $this->id); $verb = "Update"; $rs = $this->db->update("loco_unit", $data, $where); } // Update the registry $Registry = Registry::getInstance(); $regkey = sprintf(self::REGISTRY_KEY, $this->id); $Registry->remove($regkey)->set($regkey, $this); $this->Memcached->delete(sprintf(self::CACHE_KEY_DESC, $this->id)); Debug::logEvent("Zend_DB: commit loco ID " . $this->id, $timer); $this->makeLinks(); return true; }