function SqlContentEntityStorage::setFieldStorageDefinitions

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

Updates the internal list of field storage definitions.

@internal Only to be used internally by Entity API.

Parameters

\Drupal\Core\Field\FieldStorageDefinitionInterface[] $field_storage_definitions: An array of field storage definitions.

File

core/lib/Drupal/Core/Entity/Sql/SqlContentEntityStorage.php, line 302

Class

SqlContentEntityStorage
A content entity database storage implementation.

Namespace

Drupal\Core\Entity\Sql

Code

public function setFieldStorageDefinitions(array $field_storage_definitions) {
    foreach ($field_storage_definitions as $field_storage_definition) {
        if ($field_storage_definition->getTargetEntityTypeId() !== $this->entityType
            ->id()) {
            throw new EntityStorageException("Unsupported entity type {$field_storage_definition->getTargetEntityTypeId()}");
        }
    }
    $this->fieldStorageDefinitions = $field_storage_definitions;
}

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