classes/database/orm.php
/**
	 * Saves the current object to the database (if needed).
	 *
	 * @return object
	 */
Saves the current object to the database (if needed).
@return object
Saves the current object to the database ( if needed ) . @return object
public function save()
	{
		if ( ! $this->_changed)
		{
			return $this;
		}
		$data = array();
		foreach ($this->_changed as $column)
		{
			$data[$column] = $this->_object[$column];
		}
		if ( ! $this->empty_pk() AND ! isset($this->_changed[$this->_primary_key]))
		{
			$this->update($data);
		}
		else
		{
			$this->insert($data);
		}
		$this->_changed = array();
		return $this;
	}
public function save ( ) { if ( ! $ this -> _changed ) { return $ this ; } $ data = array ( ) ; foreach ( $ this -> _changed as $ column ) { $ data [ $ column ] = $ this -> _object [ $ column ] ; } if ( ! $ this -> empty_pk ( ) AND ! isset ( $ this -> _changed [ $ this -> _primary_key ] ) ) { $ this -> update ( $ data ) ; } else { $ this -> insert ( $ data ) ; } $ this -> _changed = array ( ) ; return $ this ; }
Saves the current object to the database (if needed).
Saves the current object to the database ( if needed ) .
// Compile changed data // Primary key isn't empty and hasn't been changed so do an update // All changes have been saved