function SqlContentEntityStorageSchema::getTableNames
Same name in other branches
- 9 core/lib/Drupal/Core/Entity/Sql/SqlContentEntityStorageSchema.php \Drupal\Core\Entity\Sql\SqlContentEntityStorageSchema::getTableNames()
- 8.9.x core/lib/Drupal/Core/Entity/Sql/SqlContentEntityStorageSchema.php \Drupal\Core\Entity\Sql\SqlContentEntityStorageSchema::getTableNames()
- 11.x core/lib/Drupal/Core/Entity/Sql/SqlContentEntityStorageSchema.php \Drupal\Core\Entity\Sql\SqlContentEntityStorageSchema::getTableNames()
Gets a list of table names for this entity type, field storage and mapping.
The default table mapping does not return dedicated revision table names for non-revisionable fields attached to revisionable entity types. Since both the storage and the storage handlers expect them to be existing, the missing table names need to be manually restored.
@todo Remove this once the behavior of the default table mapping, the storage handler, and the storage schema handler are reconciled in https://www.drupal.org/node/3113639.
Parameters
\Drupal\Core\Entity\EntityTypeInterface $entity_type: An entity type definition.
\Drupal\Core\Field\FieldStorageDefinitionInterface[] $field_storage_definitions: An array of field storage definitions.
\Drupal\Core\Entity\Sql\TableMappingInterface $table_mapping: A table mapping.
Return value
string[] An array of field table names.
3 calls to SqlContentEntityStorageSchema::getTableNames()
- SqlContentEntityStorageSchema::onEntityTypeDelete in core/
lib/ Drupal/ Core/ Entity/ Sql/ SqlContentEntityStorageSchema.php - SqlContentEntityStorageSchema::postUpdateEntityTypeSchema in core/
lib/ Drupal/ Core/ Entity/ Sql/ SqlContentEntityStorageSchema.php - Allows subscribers to do any cleanup necessary after data copying.
- SqlContentEntityStorageSchema::preUpdateEntityTypeSchema in core/
lib/ Drupal/ Core/ Entity/ Sql/ SqlContentEntityStorageSchema.php - Allows subscribers to prepare their schema before data copying.
File
-
core/
lib/ Drupal/ Core/ Entity/ Sql/ SqlContentEntityStorageSchema.php, line 636
Class
- SqlContentEntityStorageSchema
- Defines a schema handler that supports revisionable, translatable entities.
Namespace
Drupal\Core\Entity\SqlCode
private function getTableNames(EntityTypeInterface $entity_type, array $field_storage_definitions, TableMappingInterface $table_mapping) {
$table_names = $table_mapping->getTableNames();
if ($table_mapping instanceof DefaultTableMapping && $entity_type->isRevisionable()) {
foreach ($field_storage_definitions as $storage_definition) {
if ($table_mapping->requiresDedicatedTableStorage($storage_definition)) {
$dedicated_revision_table_name = $table_mapping->getDedicatedRevisionTableName($storage_definition);
if (!$storage_definition->isRevisionable() && !in_array($dedicated_revision_table_name, $table_names)) {
$table_names[] = $dedicated_revision_table_name;
}
}
}
}
return $table_names;
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.