Final Class Yiisoft\Db\Constraint\ForeignKey
| Inheritance | Yiisoft\Db\Constraint\ForeignKey |
|---|
Represents a foreign key constraint in a database.
A foreign key constraint is a constraint that enforces referential integrity between two tables.
It has information about the table and column(s) that the constraint applies to, as well as any actions that should be taken when a referenced record is deleted or updated.
Public Properties
Public Methods
| Method | Description | Defined By |
|---|---|---|
| __construct() | Yiisoft\Db\Constraint\ForeignKey |
Property Details
Method Details
| public mixed __construct ( string $name = '', string[] $columnNames = [], string $foreignSchemaName = '', string $foreignTableName = '', string[] $foreignColumnNames = [], string|null $onDelete = null, string|null $onUpdate = null ) | ||
| $name | string |
The constraint name. |
| $columnNames | string[] |
The list of column names the constraint belongs to. |
| $foreignSchemaName | string |
The referenced schema name. |
| $foreignTableName | string |
The referenced table name. |
| $foreignColumnNames | string[] |
The list of referenced table column names. |
| $onDelete | string|null |
The referential action if rows in a referenced table are to be deleted. |
| $onUpdate | string|null |
The referential action if rows in a referenced table are to be updated. |
public function __construct(
public readonly string $name = '',
public readonly array $columnNames = [],
public readonly string $foreignSchemaName = '',
public readonly string $foreignTableName = '',
public readonly array $foreignColumnNames = [],
public readonly ?string $onDelete = null,
public readonly ?string $onUpdate = null,
) {}
Signup or Login in order to comment.