framework/db/ActiveRecord.php
public function loadDefaultValues($skipIfSet = true)
    {
        foreach (static::getTableSchema()->columns as $column) {
            if ($column->defaultValue !== null && (!$skipIfSet || $this->{$column->name} === null)) {
                $this->{$column->name} = $column->defaultValue;
            }
        }

        return $this;
    }
public function loadDefaultValues($skipIfSet = true)
    {
        foreach (static::getTableSchema()->columns as $column) {
            if ($column->defaultValue !== null && (!$skipIfSet || $this->{$column->name} === null)) {
                $this->{$column->name} = $column->defaultValue;
            }
        }

        return $this;
    }
Loads default values from database table schema.

You may call this method to load default values after creating a new instance:

```php
// class Customer extends \yii\db\ActiveRecord
$customer = new Customer();
$customer->loadDefaultValues();
```

@param bool $skipIfSet whether existing value should be preserved.
This will only set defaults for attributes that are `null`.
@return $this the model instance itself.