function PathAliasStorageSchema::getEntitySchema
Same name and namespace in other branches
- 9 core/modules/path_alias/src/PathAliasStorageSchema.php \Drupal\path_alias\PathAliasStorageSchema::getEntitySchema()
- 8.9.x core/modules/path_alias/src/PathAliasStorageSchema.php \Drupal\path_alias\PathAliasStorageSchema::getEntitySchema()
- 11.x core/modules/path_alias/src/PathAliasStorageSchema.php \Drupal\path_alias\PathAliasStorageSchema::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.
Overrides SqlContentEntityStorageSchema::getEntitySchema
File
-
core/
modules/ path_alias/ src/ PathAliasStorageSchema.php, line 16
Class
- PathAliasStorageSchema
- Defines the path_alias schema handler.
Namespace
Drupal\path_aliasCode
protected function getEntitySchema(ContentEntityTypeInterface $entity_type, $reset = FALSE) {
$schema = parent::getEntitySchema($entity_type, $reset);
$base_table = $this->storage
->getBaseTable();
$schema[$base_table]['indexes'] += [
'path_alias__alias_langcode_id_status' => [
'alias',
'langcode',
'id',
'status',
],
'path_alias__path_langcode_id_status' => [
'path',
'langcode',
'id',
'status',
],
];
// Unset the path_alias__status index as it is slower than the above
// indexes and MySQL 5.7 chooses to use it even though it is suboptimal.
unset($schema[$base_table]['indexes']['path_alias__status']);
return $schema;
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.