function SqlContentEntityStorageSchema::initializeBaseTable
Same name in other branches
- 9 core/lib/Drupal/Core/Entity/Sql/SqlContentEntityStorageSchema.php \Drupal\Core\Entity\Sql\SqlContentEntityStorageSchema::initializeBaseTable()
- 8.9.x core/lib/Drupal/Core/Entity/Sql/SqlContentEntityStorageSchema.php \Drupal\Core\Entity\Sql\SqlContentEntityStorageSchema::initializeBaseTable()
- 10 core/lib/Drupal/Core/Entity/Sql/SqlContentEntityStorageSchema.php \Drupal\Core\Entity\Sql\SqlContentEntityStorageSchema::initializeBaseTable()
Initializes common information for a base table.
Parameters
\Drupal\Core\Entity\ContentEntityTypeInterface $entity_type: The entity type.
Return value
array A partial schema array for the base table.
1 call to SqlContentEntityStorageSchema::initializeBaseTable()
- SqlContentEntityStorageSchema::getEntitySchema in core/
lib/ Drupal/ Core/ Entity/ Sql/ SqlContentEntityStorageSchema.php - Gets the entity schema for the specified entity type.
File
-
core/
lib/ Drupal/ Core/ Entity/ Sql/ SqlContentEntityStorageSchema.php, line 1304
Class
- SqlContentEntityStorageSchema
- Defines a schema handler that supports revisionable, translatable entities.
Namespace
Drupal\Core\Entity\SqlCode
protected function initializeBaseTable(ContentEntityTypeInterface $entity_type) {
$entity_type_id = $entity_type->id();
$schema = [
'description' => "The base table for {$entity_type_id} entities.",
'primary key' => [
$entity_type->getKey('id'),
],
'indexes' => [],
'foreign keys' => [],
];
if ($entity_type->hasKey('revision')) {
$revision_key = $entity_type->getKey('revision');
$key_name = $this->getEntityIndexName($entity_type, $revision_key);
$schema['unique keys'][$key_name] = [
$revision_key,
];
$schema['foreign keys'][$entity_type_id . '__revision'] = [
'table' => $this->storage
->getRevisionTable(),
'columns' => [
$revision_key => $revision_key,
],
];
}
$this->addTableDefaults($schema);
return $schema;
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.