You are here

protected function EntityTestStorageSchema::getEntitySchema in Zircon Profile 8.0

Same name and namespace in other branches
  1. 8 core/modules/system/tests/modules/entity_test/src/EntityTestStorageSchema.php \Drupal\entity_test\EntityTestStorageSchema::getEntitySchema()

Gets the entity schema for the specified entity type.

Entity types may override this method in order to optimize the generated schema of the entity tables. However, only cross-field optimizations should be added here; e.g., an index spanning multiple fields. Optimizations that apply to a single field have to be added via SqlContentEntityStorageSchema::getSharedTableFieldSchema() instead.

Parameters

\Drupal\Core\Entity\ContentEntityTypeInterface $entity_type: The entity type definition.

bool $reset: (optional) If set to TRUE static cache will be ignored and a new schema array generation will be performed. Defaults to FALSE.

Return value

array A Schema API array describing the entity schema, excluding dedicated field tables.

Throws

\Drupal\Core\Field\FieldException

Overrides SqlContentEntityStorageSchema::getEntitySchema

File

core/modules/system/tests/modules/entity_test/src/EntityTestStorageSchema.php, line 22
Contains \Drupal\entity_test\EntityTestStorageSchema.

Class

EntityTestStorageSchema
Defines the entity_test_update storage_schema handler.

Namespace

Drupal\entity_test

Code

protected function getEntitySchema(ContentEntityTypeInterface $entity_type, $reset = FALSE) {
  $schema = parent::getEntitySchema($entity_type, $reset);
  if ($entity_type
    ->id() == 'entity_test_update') {
    $schema[$entity_type
      ->getBaseTable()]['indexes'] += \Drupal::state()
      ->get('entity_test_update.additional_entity_indexes', array());
  }
  return $schema;
}