yii\db\BaseActiveRecord::updateAttributes PHP Method

updateAttributes() public method

This method is a shortcut to BaseActiveRecord::update when data validation is not needed and only a small set attributes need to be updated. You may specify the attributes to be updated as name list or name-value pairs. If the latter, the corresponding attribute values will be modified accordingly. The method will then save the specified attributes into database. Note that this method will **not** perform data validation and will **not** trigger events.
public updateAttributes ( array $attributes ) : integer
$attributes array the attributes (names or name-value pairs) to be updated
return integer the number of rows affected.
    public function updateAttributes($attributes)
    {
        $attrs = [];
        foreach ($attributes as $name => $value) {
            if (is_int($name)) {
                $attrs[] = $value;
            } else {
                $this->{$name} = $value;
                $attrs[] = $name;
            }
        }
        $values = $this->getDirtyAttributes($attrs);
        if (empty($values) || $this->getIsNewRecord()) {
            return 0;
        }
        $rows = static::updateAll($values, $this->getOldPrimaryKey(true));
        foreach ($values as $name => $value) {
            $this->_oldAttributes[$name] = $this->_attributes[$name];
        }
        return $rows;
    }