3 namespace Drupal\entity_test_update;
5 use Drupal\Core\Entity\ContentEntityTypeInterface;
6 use Drupal\Core\Entity\Sql\SqlContentEntityStorageSchema;
7 use Drupal\Core\Field\FieldStorageDefinitionInterface;
10 * Defines the entity_test_update storage_schema handler.
12 class EntityTestUpdateStorageSchema extends SqlContentEntityStorageSchema {
17 protected function getEntitySchema(ContentEntityTypeInterface $entity_type, $reset = FALSE) {
18 $schema = parent::getEntitySchema($entity_type, $reset);
20 if ($entity_type->id() == 'entity_test_update') {
21 $schema[$this->storage->getBaseTable()]['indexes'] += \Drupal::state()->get('entity_test_update.additional_entity_indexes', []);
29 protected function getSharedTableFieldSchema(FieldStorageDefinitionInterface $storage_definition, $table_name, array $column_mapping) {
30 $schema = parent::getSharedTableFieldSchema($storage_definition, $table_name, $column_mapping);
32 if (\Drupal::state()->get('entity_test_update.additional_field_index.' . $table_name . '.' . $storage_definition->getName())) {
33 $this->addSharedTableFieldIndex($storage_definition, $schema);