Upgraded drupal core with security updates
[yaffs-website] / web / core / modules / content_moderation / src / ContentModerationStateStorageSchema.php
1 <?php
2
3 namespace Drupal\content_moderation;
4
5 use Drupal\Core\Entity\ContentEntityTypeInterface;
6 use Drupal\Core\Entity\Sql\SqlContentEntityStorageSchema;
7
8 /**
9  * Defines the content moderation state schema handler.
10  */
11 class ContentModerationStateStorageSchema extends SqlContentEntityStorageSchema {
12
13   /**
14    * {@inheritdoc}
15    */
16   protected function getEntitySchema(ContentEntityTypeInterface $entity_type, $reset = FALSE) {
17     $schema = parent::getEntitySchema($entity_type, $reset);
18
19     // Creates unique keys to guarantee the integrity of the entity and to make
20     // the lookup in ModerationStateFieldItemList::getModerationState() fast.
21     $unique_keys = [
22       'content_entity_type_id',
23       'content_entity_id',
24       'content_entity_revision_id',
25       'workflow',
26       'langcode',
27     ];
28     $schema['content_moderation_state_field_data']['unique keys'] += [
29       'content_moderation_state__lookup' => $unique_keys,
30     ];
31     $schema['content_moderation_state_field_revision']['unique keys'] += [
32       'content_moderation_state__lookup' => $unique_keys,
33     ];
34
35     return $schema;
36   }
37
38 }