示例#1
0
	public function save($doAudit = true) {
		$field = $this->table->getPrimary();
		
		// make sure data is valid
		if (!$this->_validated) {
			$this->validate();
		}
		if ($this->isValidated()) {
			$this->generateSafeTitle();
			
			if ($this->row->$field) {
				$this->beforeUpdate();
				$this->row->save();
				$this->afterUpdate();
			}
			else {
				$this->beforeInsert();
				$this->generateHash();
				$this->row->save();
				$this->afterInsert();
			}
			return true;
		}
		else {
			return false;
		}
			
	}