public function modify($data=null, $where=null)
    {
        $this->set($data, $where);
        $query = static::getQuery();
        
        // verify data
        $mdata = $query->get('data');
        $mwhere = $query->get('where');
        
        if (!$query->formatted()) {
            $mdata = static::formatInput($mdata);
            $query->remove('data')->setRaw('data', $mdata);
            
            $res = static::verifyData($mdata);
            if ($res['errcode']) {
                return $res;
            }
        }
        
        if (static::isEmptyData($mdata)) {
            return ErrorInfo::success('donot need modify.');
        }
        
        if (!$mwhere) {
            // clone query
            $clone = $query->clone();
            $res = $this->setQuery($clone)->verifyUnique($mdata, $mwhere);
            if ($res->isError()) {
                return $res;
            }
        }
        
        $ret = $this->setQuery($query)->update()->query();
        
        return ErrorInfo::instance($ret === false ? -1 : 0);
    }
public function modify($data=null, $where=null)
    {
        $this->set($data, $where);
        $query = static::getQuery();
        
        // verify data
        $mdata = $query->get('data');
        $mwhere = $query->get('where');
        
        if (!$query->formatted()) {
            $mdata = static::formatInput($mdata);
            $query->remove('data')->setRaw('data', $mdata);
            
            $res = static::verifyData($mdata);
            if ($res['errcode']) {
                return $res;
            }
        }
        
        if (static::isEmptyData($mdata)) {
            return ErrorInfo::success('donot need modify.');
        }
        
        if (!$mwhere) {
            // clone query
            $clone = $query->clone();
            $res = $this->setQuery($clone)->verifyUnique($mdata, $mwhere);
            if ($res->isError()) {
                return $res;
            }
        }
        
        $ret = $this->setQuery($query)->update()->query();
        
        return ErrorInfo::instance($ret === false ? -1 : 0);
    }
public function modify ( $ data = null , $ where = null ) { $ this -> set ( $ data , $ where ) ; $ query = static :: getQuery ( ) ; // verify data $ mdata = $ query -> get ( 'data' ) ; $ mwhere = $ query -> get ( 'where' ) ; if ( ! $ query -> formatted ( ) ) { $ mdata = static :: formatInput ( $ mdata ) ; $ query -> remove ( 'data' ) -> setRaw ( 'data' , $ mdata ) ; $ res = static :: verifyData ( $ mdata ) ; if ( $ res [ 'errcode' ] ) { return $ res ; } } if ( static :: isEmptyData ( $ mdata ) ) { return ErrorInfo :: success ( 'donot need modify.' ) ; } if ( ! $ mwhere ) { // clone query $ clone = $ query -> clone ( ) ; $ res = $ this -> setQuery ( $ clone ) -> verifyUnique ( $ mdata , $ mwhere ) ; if ( $ res -> isError ( ) ) { return $ res ; } } $ ret = $ this -> setQuery ( $ query ) -> update ( ) -> query ( ) ; return ErrorInfo :: instance ( $ ret === false ? - 1 : 0 ) ; }
update only, return false if update
It is different of save, save can be insert or update

@param  array $data
@param  array|string $where
@return \Wslim\Common\ErrorInfo
update only return false if update It is different of save save can be insert or update