protected function SqlContentEntityStorageSchema::createDedicatedTableSchema

protected SqlContentEntityStorageSchema::createDedicatedTableSchema(FieldStorageDefinitionInterface $storage_definition)

Creates the schema for a field stored in a dedicated table.

Parameters

\Drupal\Core\Field\FieldStorageDefinitionInterface $storage_definition: The storage definition of the field being created.

File

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

Class

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

Namespace

Drupal\Core\Entity\Sql

Code

protected function createDedicatedTableSchema(FieldStorageDefinitionInterface $storage_definition) {
  $schema = $this->getDedicatedTableSchema($storage_definition);
  foreach ($schema as $name => $table) {
    // Check if the table exists because it might already have been
    // created as part of the earlier entity type update event.
    if (!$this->database->schema()->tableExists($name)) {
      $this->database->schema()->createTable($name, $table);
    }
  }
  $this->saveFieldSchemaData($storage_definition, $schema);
}

© 2001–2016 by the original authors
Licensed under the GNU General Public License, version 2 and later.
Drupal is a registered trademark of Dries Buytaert.
https://api.drupal.org/api/drupal/core!lib!Drupal!Core!Entity!Sql!SqlContentEntityStorageSchema.php/function/SqlContentEntityStorageSchema::createDedicatedTableSchema/8.1.x