Daniia/Daniia.php
final public function save($closure=NULL) {
      $updated = FALSE;
      if ($this->find_save_data && @$this->data->{$this->primaryKey}) {
         $updated = $this->update((array)$this->data);
      }

      $last_id = NULL;
      if (($this->find_save_data && !@$this->data->{$this->primaryKey}) || !$updated) {
         $last_id = $this->insertGetId((array)$this->data);
      }

      $this->find_save_data = FALSE;

      $lastQuery = $this->lastQuery();

      $error = $this->error();
      if ( $error['message'] ) {
         return FALSE;
      }

      if ( $last_id ) {
         $this->where( $this->primaryKey, $last_id );
         $this->get();
         $this->last_sql = $lastQuery ."\n". $this->lastQuery();
      }

      if ($closure instanceof \Closure) {
         $this->data = $closure( $this->data, $this );
      }

      $error = $this->error();
      return $error['message'] ? FALSE : TRUE;
   }
final public function save($closure=NULL) {
      $updated = FALSE;
      if ($this->find_save_data && @$this->data->{$this->primaryKey}) {
         $updated = $this->update((array)$this->data);
      }

      $last_id = NULL;
      if (($this->find_save_data && !@$this->data->{$this->primaryKey}) || !$updated) {
         $last_id = $this->insertGetId((array)$this->data);
      }

      $this->find_save_data = FALSE;

      $lastQuery = $this->lastQuery();

      $error = $this->error();
      if ( $error['message'] ) {
         return FALSE;
      }

      if ( $last_id ) {
         $this->where( $this->primaryKey, $last_id );
         $this->get();
         $this->last_sql = $lastQuery ."\n". $this->lastQuery();
      }

      if ($closure instanceof \Closure) {
         $this->data = $closure( $this->data, $this );
      }

      $error = $this->error();
      return $error['message'] ? FALSE : TRUE;
   }
final public function save ( $ closure = NULL ) { $ updated = FALSE ; if ( $ this -> find_save_data && @ $ this -> data -> { $ this -> primaryKey } ) { $ updated = $ this -> update ( ( array ) $ this -> data ) ; } $ last_id = NULL ; if ( ( $ this -> find_save_data && ! @ $ this -> data -> { $ this -> primaryKey } ) || ! $ updated ) { $ last_id = $ this -> insertGetId ( ( array ) $ this -> data ) ; } $ this -> find_save_data = FALSE ; $ lastQuery = $ this -> lastQuery ( ) ; $ error = $ this -> error ( ) ; if ( $ error [ 'message' ] ) { return FALSE ; } if ( $ last_id ) { $ this -> where ( $ this -> primaryKey , $ last_id ) ; $ this -> get ( ) ; $ this -> last_sql = $ lastQuery . "\n" . $ this -> lastQuery ( ) ; } if ( $ closure instanceof \ Closure ) { $ this -> data = $ closure ( $ this -> data , $ this ) ; } $ error = $ this -> error ( ) ; return $ error [ 'message' ] ? FALSE : TRUE ; }
actualiza o crea un registro en la base de datos
@author Carlos Garcia
@return boolean
actualiza o crea un registro en la base de datos