function SqlContentEntityStorageSchema::requiresFieldStorageSchemaChanges

Same name in other branches
  1. 9 core/lib/Drupal/Core/Entity/Sql/SqlContentEntityStorageSchema.php \Drupal\Core\Entity\Sql\SqlContentEntityStorageSchema::requiresFieldStorageSchemaChanges()
  2. 8.9.x core/lib/Drupal/Core/Entity/Sql/SqlContentEntityStorageSchema.php \Drupal\Core\Entity\Sql\SqlContentEntityStorageSchema::requiresFieldStorageSchemaChanges()
  3. 11.x core/lib/Drupal/Core/Entity/Sql/SqlContentEntityStorageSchema.php \Drupal\Core\Entity\Sql\SqlContentEntityStorageSchema::requiresFieldStorageSchemaChanges()

Overrides DynamicallyFieldableEntityStorageSchemaInterface::requiresFieldStorageSchemaChanges

File

core/lib/Drupal/Core/Entity/Sql/SqlContentEntityStorageSchema.php, line 261

Class

SqlContentEntityStorageSchema
Defines a schema handler that supports revisionable, translatable entities.

Namespace

Drupal\Core\Entity\Sql

Code

public function requiresFieldStorageSchemaChanges(FieldStorageDefinitionInterface $storage_definition, FieldStorageDefinitionInterface $original) {
    $table_mapping = $this->getTableMapping($this->entityType);
    if ($storage_definition->hasCustomStorage() != $original->hasCustomStorage() || $storage_definition->getSchema() != $original->getSchema() || $storage_definition->isRevisionable() != $original->isRevisionable() || $table_mapping->allowsSharedTableStorage($storage_definition) != $table_mapping->allowsSharedTableStorage($original) || $table_mapping->requiresDedicatedTableStorage($storage_definition) != $table_mapping->requiresDedicatedTableStorage($original)) {
        return TRUE;
    }
    if ($storage_definition->hasCustomStorage()) {
        // The field has custom storage, so we don't know if a schema change is
        // needed or not, but since per the initial checks earlier in this
        // function, nothing about the definition changed that we manage, we
        // return FALSE.
        return FALSE;
    }
    $current_schema = $this->getSchemaFromStorageDefinition($storage_definition);
    $this->processFieldStorageSchema($current_schema);
    $installed_schema = $this->loadFieldSchemaData($original);
    $this->processFieldStorageSchema($installed_schema);
    return $current_schema != $installed_schema;
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.