function EntityDefinitionUpdateManager::installFieldStorageDefinition

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

Overrides EntityDefinitionUpdateManagerInterface::installFieldStorageDefinition

File

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

Class

EntityDefinitionUpdateManager
Manages entity definition updates.

Namespace

Drupal\Core\Entity

Code

public function installFieldStorageDefinition($name, $entity_type_id, $provider, FieldStorageDefinitionInterface $storage_definition) {
    // @todo Pass a mutable field definition interface when we have one. See
    //   https://www.drupal.org/node/2346329.
    if ($storage_definition instanceof BaseFieldDefinition) {
        $storage_definition->setName($name)
            ->setTargetEntityTypeId($entity_type_id)
            ->setProvider($provider)
            ->setTargetBundle(NULL);
    }
    $this->clearCachedDefinitions();
    $this->fieldStorageDefinitionListener
        ->onFieldStorageDefinitionCreate($storage_definition);
}

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