src/db/SwooleTableActiveRecord.php
/**
     * Updates all documents in the collection using the provided attribute values and conditions.
     * For example, to change the status to be 1 for all customers whose status is 2:
     *
     * ```php
     * Customer::updateAll(['status' => 1], ['status' => 2]);
     * ```
     *
     * @param array $attributes attribute values (name-value pairs) to be saved into the collection
     * @param array $condition description of the objects to update.
     * Please refer to [[Query::where()]] on how to specify this parameter.
     * @param array $options list of options in format: optionName => optionValue.
     * @return int the number of documents updated.
     */
Updates all documents in the collection using the provided attribute values and conditions.
For example, to change the status to be 1 for all customers whose status is 2.



@param array $attributes attribute values (name-value pairs) to be saved into the collection
@param array $condition description of the objects to update.
Please refer to [[Query::where()]] on how to specify this parameter.
@param array $options list of options in format: optionName => optionValue.
@return int the number of documents updated.
Updates all documents in the collection using the provided attribute values and conditions . For example to change the status to be 1 for all customers whose status is 2 . @param array $attributes attribute values ( name - value pairs ) to be saved into the collection @param array $condition description of the objects to update . Please refer to [[ Query :: where () ]] on how to specify this parameter . @param array $options list of options in format : optionName = > optionValue . @return int the number of documents updated .
public static function updateAll($attributes, $condition = [], $options = [])
    {
        $models = self::findAll($condition);
        $return  = false;
        foreach($models as $row){
            $class = get_called_class();
            $model = $class::instantiate($row);
            $modelClass = get_class($model);
            $modelClass::populateRecord($model, $row);
            $del = static::$swooleTable->del($model->getKey(true));
            if($del){
                $set = static::$swooleTable->set($model->getKey(), array_merge($model->toArray(), $attributes));
                $return = $return || $set;
            }
        }
        return $return;
    }
public static function updateAll ( $ attributes , $ condition = [ ] , $ options = [ ] ) { $ models = self :: findAll ( $ condition ) ; $ return = false ; foreach ( $ models as $ row ) { $ class = get_called_class ( ) ; $ model = $ class :: instantiate ( $ row ) ; $ modelClass = get_class ( $ model ) ; $ modelClass :: populateRecord ( $ model , $ row ) ; $ del = static :: $ swooleTable -> del ( $ model -> getKey ( true ) ) ; if ( $ del ) { $ set = static :: $ swooleTable -> set ( $ model -> getKey ( ) , array_merge ( $ model -> toArray ( ) , $ attributes ) ) ; $ return = $ return || $ set ; } } return $ return ; }
Updates all documents in the collection using the provided attribute values and conditions.
Updates all documents in the collection using the provided attribute values and conditions .