CommentStorageSchema::getEntitySchema

protected CommentStorageSchema::getEntitySchema(ContentEntityTypeInterface $entity_type, $reset = FALSE)

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/comment/src/CommentStorageSchema.php, line 17

Class

CommentStorageSchema
Defines the comment schema handler.

Namespace

Drupal\comment

Code

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
protected function getEntitySchema(ContentEntityTypeInterface $entity_type, $reset = FALSE) {
  $schema = parent::getEntitySchema($entity_type, $reset);
 
  $schema['comment_field_data']['indexes'] += array(
    'comment__status_pid' => array('pid', 'status'),
    'comment__num_new' => array(
      'entity_id',
      'entity_type',
      'comment_type',
      'status',
      'created',
      'cid',
      'thread',
    ),
    'comment__entity_langcode' => array(
      'entity_id',
      'entity_type',
      'comment_type',
      'default_langcode',
    ),
  );
 
  return $schema;
}
doc_Drupal
2025-01-10 15:47:30
Comments
Leave a Comment

Please login to continue.