protected function SqlContentEntityStorageSchema::hasSharedTableNameChanges in Drupal 9
Same name and namespace in other branches
- 8 core/lib/Drupal/Core/Entity/Sql/SqlContentEntityStorageSchema.php \Drupal\Core\Entity\Sql\SqlContentEntityStorageSchema::hasSharedTableNameChanges()
Detects whether any table name got renamed in an entity type update.
Parameters
\Drupal\Core\Entity\EntityTypeInterface $entity_type: The new entity type.
\Drupal\Core\Entity\EntityTypeInterface $original: The origin entity type.
Return value
bool Returns TRUE if there have been changes.
1 call to SqlContentEntityStorageSchema::hasSharedTableNameChanges()
- SqlContentEntityStorageSchema::hasSharedTableStructureChange in core/
lib/ Drupal/ Core/ Entity/ Sql/ SqlContentEntityStorageSchema.php - Detects whether there is a change in the shared table structure.
File
- core/
lib/ Drupal/ Core/ Entity/ Sql/ SqlContentEntityStorageSchema.php, line 243
Class
- SqlContentEntityStorageSchema
- Defines a schema handler that supports revisionable, translatable entities.
Namespace
Drupal\Core\Entity\SqlCode
protected function hasSharedTableNameChanges(EntityTypeInterface $entity_type, EntityTypeInterface $original) {
$base_table = $this->database
->schema()
->tableExists($entity_type
->getBaseTable());
$data_table = $this->database
->schema()
->tableExists($entity_type
->getDataTable());
$revision_table = $this->database
->schema()
->tableExists($entity_type
->getRevisionTable());
$revision_data_table = $this->database
->schema()
->tableExists($entity_type
->getRevisionDataTable());
// We first check if the new table already exists because the storage might
// have created it even though it wasn't specified in the entity type
// definition.
return !$base_table && $entity_type
->getBaseTable() != $original
->getBaseTable() || !$data_table && $entity_type
->getDataTable() != $original
->getDataTable() || !$revision_table && $entity_type
->getRevisionTable() != $original
->getRevisionTable() || !$revision_data_table && $entity_type
->getRevisionDataTable() != $original
->getRevisionDataTable();
}