function Table::__construct
Same name and namespace in other branches
- 11.x core/lib/Drupal/Core/Database/SchemaDefinition/Table.php \Drupal\Core\Database\SchemaDefinition\Table::__construct()
Constructor.
Parameters
string $name: The table name.
?Column[] $columns: (Optional) An array that describes the table's database columns. This is normally mandatory. Some methods in the Schema API - for example Schema::addField() - require partial table definition, so this is optional to support it.
?string $description: (Optional) A string in non-markup plain text describing this table and its purpose. References to other tables should be enclosed in curly brackets.
?PrimaryKey $primaryKey: (Optional) The primary key of the table.
?UniqueKey[] $uniqueKeys: (Optional) An array of unique keys for the table.
?Index[] $indexes: (Optional) An array of indexes for the table.
?ForeignKey[] $foreignKeys: (Optional) An array of foreign keys for the table. This argument is for documentation purposes only; foreign keys are not created in the database, nor are they enforced by Drupal.
array<string,array<string,mixed>>|null $dbSpecificExtra: (Optional) If you need to define a table requiring information not included elsewhere, you can specify it for each database backend. Specify this as an associative array having the database type ('mysql', 'sqlite', 'pgsql', 'oracle', etc.) as the key, and an array of extra information <string,mixed> as the value.
File
-
core/
lib/ Drupal/ Core/ Database/ SchemaDefinition/ Table.php, line 46
Class
- Table
- Describes a database table.
Namespace
Drupal\Core\Database\SchemaDefinitionCode
public function __construct(public readonly string $name, public readonly ?array $columns = NULL, public readonly ?string $description = NULL, public readonly ?PrimaryKey $primaryKey = NULL, public readonly ?array $uniqueKeys = NULL, public readonly ?array $indexes = NULL, public readonly ?array $foreignKeys = NULL, public readonly ?array $dbSpecificExtra = NULL) {
$this->validate();
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.