original_string: 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;
      }
code: 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;
      }
code_tokens: 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 ; }
docstring: Save model into database and load it back.
  If for some reason it won't load, whole operation is undone.
docstring_tokens: Save model into database and load it back . If for some reason it won t load whole operation is undone .