function ForeignKey::__construct
Constructor.
Parameters
string $name: The foreign key name.
string $foreignTable: The foreign (referenced) table name.
list<KeyColumn|string> $columns: A mix of key column specifiers, being KeyColumn objects, strings naming columns, or arrays of two elements, column name and length, specifying a prefix of the named column.
list<KeyColumn|string> $foreignColumns: A mix of key column specifiers of the foreign (referenced) table, being KeyColumn objects, strings naming columns, or arrays of two elements, column name and length, specifying a prefix of the named column.
Overrides KeyBase::__construct
File
-
core/
lib/ Drupal/ Core/ Database/ SchemaDefinition/ ForeignKey.php, line 38
Class
- ForeignKey
- Describes a database foreign key.
Namespace
Drupal\Core\Database\SchemaDefinitionCode
public function __construct(public readonly string $name, public readonly string $foreignTable, array $columns, array $foreignColumns) {
parent::__construct($columns, FALSE);
$this->foreignColumns = $this->buildKeyColumns($foreignColumns, FALSE);
$this->validate();
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.