public function save()
    {
        $this->_dsql()->owner->beginTransaction();
        $this->hook('beforeSave');

        // decide, insert or modify
        if ($this->loaded()) {
            $res = $this->modify();
        } else {
            $res = $this->insert();
        }

        $res->hook('afterSave');
        $this->_dsql()->owner->commit();

        return $res;
    }
public function save()
    {
        $this->_dsql()->owner->beginTransaction();
        $this->hook('beforeSave');

        // decide, insert or modify
        if ($this->loaded()) {
            $res = $this->modify();
        } else {
            $res = $this->insert();
        }

        $res->hook('afterSave');
        $this->_dsql()->owner->commit();

        return $res;
    }
public function save ( ) { $ this -> _dsql ( ) -> owner -> beginTransaction ( ) ; $ this -> hook ( 'beforeSave' ) ; // decide, insert or modify if ( $ this -> loaded ( ) ) { $ res = $ this -> modify ( ) ; } else { $ res = $ this -> insert ( ) ; } $ res -> hook ( 'afterSave' ) ; $ this -> _dsql ( ) -> owner -> commit ( ) ; return $ res ; }
Save model into database and load it back.
If for some reason it won't load, whole operation is undone.
Save model into database and load it back . If for some reason it won t load whole operation is undone .