public function update($dataset, $condFields = null, $updateNulls = false)
    {
        // Event
        $this->triggerEvent(
            'onBefore' . ucfirst(__FUNCTION__),
            [
                'dataset' => &$dataset,
                'condFields' => &$condFields,
                'updateNulls' => &$updateNulls,
            ]
        );

        if (!($dataset instanceof \Traversable) && !is_array($dataset)) {
            throw new \InvalidArgumentException('DataSet object should be instance of a Traversable');
        }

        // Handling conditions
        $condFields = $condFields ?: $this->getKeyName(true);

        $result = $this->doUpdate($dataset, (array) $condFields, $updateNulls);

        // Event
        $this->triggerEvent(
            'onAfter' . ucfirst(__FUNCTION__),
            [
                'result' => &$result,
            ]
        );

        return $result;
    }
public function update($dataset, $condFields = null, $updateNulls = false)
    {
        // Event
        $this->triggerEvent(
            'onBefore' . ucfirst(__FUNCTION__),
            [
                'dataset' => &$dataset,
                'condFields' => &$condFields,
                'updateNulls' => &$updateNulls,
            ]
        );

        if (!($dataset instanceof \Traversable) && !is_array($dataset)) {
            throw new \InvalidArgumentException('DataSet object should be instance of a Traversable');
        }

        // Handling conditions
        $condFields = $condFields ?: $this->getKeyName(true);

        $result = $this->doUpdate($dataset, (array) $condFields, $updateNulls);

        // Event
        $this->triggerEvent(
            'onAfter' . ucfirst(__FUNCTION__),
            [
                'result' => &$result,
            ]
        );

        return $result;
    }
public function update ( $ dataset , $ condFields = null , $ updateNulls = false ) { // Event $ this -> triggerEvent ( 'onBefore' . ucfirst ( __FUNCTION__ ) , [ 'dataset' => & $ dataset , 'condFields' => & $ condFields , 'updateNulls' => & $ updateNulls , ] ) ; if ( ! ( $ dataset instanceof \ Traversable ) && ! is_array ( $ dataset ) ) { throw new \ InvalidArgumentException ( 'DataSet object should be instance of a Traversable' ) ; } // Handling conditions $ condFields = $ condFields ? : $ this -> getKeyName ( true ) ; $ result = $ this -> doUpdate ( $ dataset , ( array ) $ condFields , $ updateNulls ) ; // Event $ this -> triggerEvent ( 'onAfter' . ucfirst ( __FUNCTION__ ) , [ 'result' => & $ result , ] ) ; return $ result ; }
Update records by data set. Every data depend on this table's primary key to update itself.

@param mixed $dataset      Data set contain data we want to update.
@param array $condFields   The where condition tell us record exists or not, if not set,
will use primary key instead.
@param bool  $updateNulls  Update empty fields or not.

@return mixed|DataSet
Update records by data set . Every data depend on this table s primary key to update itself .