src/db/orm/PersistableObject.php
public function save() {
        if (!$this->isPersistent()) {
            $this->dao()->transaction(function() {
                if ($this->beforeSave() !== true)               // pre-processing hook
                    return $this;
                $this->insert();
                $this->afterSave();                             // post-processing hook
            });
        }
        elseif ($this->isModified()) {
            $this->dao()->transaction(function() {
                if ($this->beforeSave() !== true)               // pre-processing hook
                    return $this;
                $this->update();
                $this->afterSave();                             // post-processing hook
            });
        }
        else {
            // persistent but not modified
        }
        return $this;
    }
public function save() {
        if (!$this->isPersistent()) {
            $this->dao()->transaction(function() {
                if ($this->beforeSave() !== true)               // pre-processing hook
                    return $this;
                $this->insert();
                $this->afterSave();                             // post-processing hook
            });
        }
        elseif ($this->isModified()) {
            $this->dao()->transaction(function() {
                if ($this->beforeSave() !== true)               // pre-processing hook
                    return $this;
                $this->update();
                $this->afterSave();                             // post-processing hook
            });
        }
        else {
            // persistent but not modified
        }
        return $this;
    }
public function save ( ) { if ( ! $ this -> isPersistent ( ) ) { $ this -> dao ( ) -> transaction ( function ( ) { if ( $ this -> beforeSave ( ) !== true ) // pre-processing hook return $ this ; $ this -> insert ( ) ; $ this -> afterSave ( ) ; // post-processing hook } ) ; } elseif ( $ this -> isModified ( ) ) { $ this -> dao ( ) -> transaction ( function ( ) { if ( $ this -> beforeSave ( ) !== true ) // pre-processing hook return $ this ; $ this -> update ( ) ; $ this -> afterSave ( ) ; // post-processing hook } ) ; } else { // persistent but not modified } return $ this ; }
Save the instance in the storage mechanism.

@return $this
Save the instance in the storage mechanism .