function FieldStorageConfig::getSchema

Same name and namespace in other branches
  1. 11.x core/modules/field/src/Entity/FieldStorageConfig.php \Drupal\field\Entity\FieldStorageConfig::getSchema()
  2. 10 core/modules/field/src/Entity/FieldStorageConfig.php \Drupal\field\Entity\FieldStorageConfig::getSchema()
  3. 8.9.x core/modules/field/src/Entity/FieldStorageConfig.php \Drupal\field\Entity\FieldStorageConfig::getSchema()

File

core/modules/field/src/Entity/FieldStorageConfig.php, line 452

Class

FieldStorageConfig
Defines the Field storage configuration entity.

Namespace

Drupal\field\Entity

Code

public function getSchema() {
  if (!isset($this->schema)) {
    // Get the schema from the field item class.
    $class = $this->getFieldItemClass();
    $schema = $class::schema($this);
    // Fill in default values for optional entries.
    $schema += [
      'columns' => [],
      'unique keys' => [],
      'indexes' => [],
      'foreign keys' => [],
    ];
    // Merge custom indexes with those specified by the field type. Custom
    // indexes prevail.
    $schema['indexes'] = $this->indexes + $schema['indexes'];
    $this->schema = $schema;
  }
  return $this->schema;
}

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