public function flush($dataset, $conditions = [])
    {
        // Handling conditions
        if (!is_array($conditions) && !is_object($conditions)) {
            $cond = [];

            foreach ((array) $this->getKeyName(true) as $field) {
                $cond[$field] = $conditions;
            }

            $conditions = $cond;
        }

        // Event
        $this->triggerEvent(
            'onBefore' . ucfirst(__FUNCTION__),
            [
                'dataset' => &$dataset,
                'conditions' => &$conditions,
            ]
        );

        $result = $this->doFlush($dataset, (array) $conditions);

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

        return $result;
    }
public function flush($dataset, $conditions = [])
    {
        // Handling conditions
        if (!is_array($conditions) && !is_object($conditions)) {
            $cond = [];

            foreach ((array) $this->getKeyName(true) as $field) {
                $cond[$field] = $conditions;
            }

            $conditions = $cond;
        }

        // Event
        $this->triggerEvent(
            'onBefore' . ucfirst(__FUNCTION__),
            [
                'dataset' => &$dataset,
                'conditions' => &$conditions,
            ]
        );

        $result = $this->doFlush($dataset, (array) $conditions);

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

        return $result;
    }
public function flush ( $ dataset , $ conditions = [ ] ) { // Handling conditions if ( ! is_array ( $ conditions ) && ! is_object ( $ conditions ) ) { $ cond = [ ] ; foreach ( ( array ) $ this -> getKeyName ( true ) as $ field ) { $ cond [ $ field ] = $ conditions ; } $ conditions = $ cond ; } // Event $ this -> triggerEvent ( 'onBefore' . ucfirst ( __FUNCTION__ ) , [ 'dataset' => & $ dataset , 'conditions' => & $ conditions , ] ) ; $ result = $ this -> doFlush ( $ dataset , ( array ) $ conditions ) ; // Event $ this -> triggerEvent ( 'onAfter' . ucfirst ( __FUNCTION__ ) , [ 'result' => & $ result , ] ) ; return $ result ; }
Flush records, will delete all by conditions then recreate new.

@param mixed $dataset    Data set contain data we want to update.
@param mixed $conditions Where conditions, you can use array or Compare object.
Example:
- `array('id' => 5)` => id = 5
- `new GteCompare('id', 20)` => 'id >= 20'
- `new Compare('id', '%Flower%', 'LIKE')` => 'id LIKE "%Flower%"'

@return  mixed|DataSet Updated data set.
Flush records will delete all by conditions then recreate new .