protected function SqlContentEntityStorageSchema::addSharedTableFieldIndex in Zircon Profile 8
Same name and namespace in other branches
- 8.0 core/lib/Drupal/Core/Entity/Sql/SqlContentEntityStorageSchema.php \Drupal\Core\Entity\Sql\SqlContentEntityStorageSchema::addSharedTableFieldIndex()
Adds an index for the specified field to the given schema definition.
Parameters
\Drupal\Core\Field\FieldStorageDefinitionInterface $storage_definition: The storage definition of the field for which an index should be added.
array $schema: A reference to the schema array to be updated.
bool $not_null: (optional) Whether to also add a 'not null' constraint to the column being indexed. Doing so improves index performance. Defaults to FALSE, in case the field needs to support NULL values.
int $size: (optional) The index size. Defaults to no limit.
9 calls to SqlContentEntityStorageSchema::addSharedTableFieldIndex()
- CommentStorageSchema::getSharedTableFieldSchema in core/
modules/ comment/ src/ CommentStorageSchema.php - Gets the schema for a single field definition.
- EntityTestStorageSchema::getSharedTableFieldSchema in core/
modules/ system/ tests/ modules/ entity_test/ src/ EntityTestStorageSchema.php - Gets the schema for a single field definition.
- FeedStorageSchema::getSharedTableFieldSchema in core/
modules/ aggregator/ src/ FeedStorageSchema.php - Gets the schema for a single field definition.
- FileStorageSchema::getSharedTableFieldSchema in core/
modules/ file/ src/ FileStorageSchema.php - Gets the schema for a single field definition.
- ItemStorageSchema::getSharedTableFieldSchema in core/
modules/ aggregator/ src/ ItemStorageSchema.php - Gets the schema for a single field definition.
File
- core/
lib/ Drupal/ Core/ Entity/ Sql/ SqlContentEntityStorageSchema.php, line 1656 - Contains \Drupal\Core\Entity\Sql\SqlContentEntityStorageSchema.
Class
- SqlContentEntityStorageSchema
- Defines a schema handler that supports revisionable, translatable entities.
Namespace
Drupal\Core\Entity\SqlCode
protected function addSharedTableFieldIndex(FieldStorageDefinitionInterface $storage_definition, &$schema, $not_null = FALSE, $size = NULL) {
$name = $storage_definition
->getName();
$real_key = $this
->getFieldSchemaIdentifierName($storage_definition
->getTargetEntityTypeId(), $name);
$schema['indexes'][$real_key] = array(
$size ? array(
$name,
$size,
) : $name,
);
if ($not_null) {
$schema['fields'][$name]['not null'] = TRUE;
}
}