EntityDefinitionUpdateManager::installFieldStorageDefinition

public EntityDefinitionUpdateManager::installFieldStorageDefinition($name, $entity_type_id, $provider, FieldStorageDefinitionInterface $storage_definition)

Installs a new field storage definition.

Parameters

string $name: The field storage definition name.

string $entity_type_id: The target entity type identifier.

string $provider: The name of the definition provider.

\Drupal\Core\Field\FieldStorageDefinitionInterface $storage_definition: The field storage definition.

Overrides EntityDefinitionUpdateManagerInterface::installFieldStorageDefinition

File

core/lib/Drupal/Core/Entity/EntityDefinitionUpdateManager.php, line 158

Class

EntityDefinitionUpdateManager
Manages entity definition updates.

Namespace

Drupal\Core\Entity

Code

1
2
3
4
5
6
7
8
9
10
11
12
13
public function installFieldStorageDefinition($name, $entity_type_id, $provider, FieldStorageDefinitionInterface $storage_definition) {
  // @todo Pass a mutable field definition interface when we have one. See
  if ($storage_definition instanceof BaseFieldDefinition) {
    $storage_definition
    ->setName($name)
      ->setTargetEntityTypeId($entity_type_id)
      ->setProvider($provider)
      ->setTargetBundle(NULL);
  }
  $this->entityManager->clearCachedDefinitions();
  $this->entityManager->onFieldStorageDefinitionCreate($storage_definition);
}
doc_Drupal
2025-01-10 15:47:30
Comments
Leave a Comment

Please login to continue.