Final Class Yiisoft\Db\Constraint\DefaultValue
| Inheritance | Yiisoft\Db\Constraint\DefaultValue |
|---|
Represents a default value constraint in a database.
A default value constraint is a constraint that enforces a default value for a column.
It can be used to specify a default value for a column when a new row is inserted into the table, and no value is provided for that column.
Also allows you to define a default value as a constant, a PHP expression, or an SQL expression that will be evaluated by the database, and can be used in migrations to define the default value for a column when creating or modifying a table.
Public Properties
| Property | Type | Description | Defined By |
|---|---|---|---|
| $columnNames | array | Yiisoft\Db\Constraint\DefaultValue | |
| $name | string | Yiisoft\Db\Constraint\DefaultValue | |
| $value | mixed | Yiisoft\Db\Constraint\DefaultValue |
Public Methods
| Method | Description | Defined By |
|---|---|---|
| __construct() | Yiisoft\Db\Constraint\DefaultValue |
Property Details
Method Details
| public mixed __construct ( string $name = '', string[] $columnNames = [], mixed $value = null ) | ||
| $name | string |
The constraint name. |
| $columnNames | string[] |
The list of column names the constraint belongs to. |
| $value | mixed |
The default value as returned by the DBMS. |
public function __construct(
public readonly string $name = '',
public readonly array $columnNames = [],
public readonly mixed $value = null,
) {}
Signup or Login in order to comment.