You are here

public function SqlContentEntityStorage::onFieldStorageDefinitionCreate in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/lib/Drupal/Core/Entity/Sql/SqlContentEntityStorage.php \Drupal\Core\Entity\Sql\SqlContentEntityStorage::onFieldStorageDefinitionCreate()

Reacts to the creation of a field storage definition.

Parameters

\Drupal\Core\Field\FieldStorageDefinitionInterface $storage_definition: The definition being created.

Overrides ContentEntityStorageBase::onFieldStorageDefinitionCreate

File

core/lib/Drupal/Core/Entity/Sql/SqlContentEntityStorage.php, line 1388
Contains \Drupal\Core\Entity\Sql\SqlContentEntityStorage.

Class

SqlContentEntityStorage
A content entity database storage implementation.

Namespace

Drupal\Core\Entity\Sql

Code

public function onFieldStorageDefinitionCreate(FieldStorageDefinitionInterface $storage_definition) {

  // If we are adding a field stored in a shared table we need to recompute
  // the table mapping.
  // @todo This does not belong here. Remove it once we are able to generate a
  //   fresh table mapping in the schema handler. See
  //   https://www.drupal.org/node/2274017.
  if ($this
    ->getTableMapping()
    ->allowsSharedTableStorage($storage_definition)) {
    $this->tableMapping = NULL;
  }
  $this
    ->wrapSchemaException(function () use ($storage_definition) {
    $this
      ->getStorageSchema()
      ->onFieldStorageDefinitionCreate($storage_definition);
  });
}