On this page
protected function SqlContentEntityStorageSchema::initializeBaseTable
protected SqlContentEntityStorageSchema::initializeBaseTable(ContentEntityTypeInterface $entity_type)
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.
File
- core/lib/Drupal/Core/Entity/Sql/SqlContentEntityStorageSchema.php, line 844
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 = array(
'description' => "The base table for $entity_type_id entities.",
'primary key' => array($entity_type->getKey('id')),
'indexes' => array(),
'foreign keys' => array(),
);
if ($entity_type->hasKey('revision')) {
$revision_key = $entity_type->getKey('revision');
$key_name = $this->getEntityIndexName($entity_type, $revision_key);
$schema['unique keys'][$key_name] = array($revision_key);
$schema['foreign keys'][$entity_type_id . '__revision'] = array(
'table' => $this->storage->getRevisionTable(),
'columns' => array($revision_key => $revision_key),
);
}
$this->addTableDefaults($schema);
return $schema;
}
© 2001–2016 by the original authors
Licensed under the GNU General Public License, version 2 and later.
Drupal is a registered trademark of Dries Buytaert.
https://api.drupal.org/api/drupal/core!lib!Drupal!Core!Entity!Sql!SqlContentEntityStorageSchema.php/function/SqlContentEntityStorageSchema::initializeBaseTable/8.1.x