function SqlContentEntityStorageSchema::getFieldSchemaIdentifierName
Same name in other branches
- 9 core/lib/Drupal/Core/Entity/Sql/SqlContentEntityStorageSchema.php \Drupal\Core\Entity\Sql\SqlContentEntityStorageSchema::getFieldSchemaIdentifierName()
- 8.9.x core/lib/Drupal/Core/Entity/Sql/SqlContentEntityStorageSchema.php \Drupal\Core\Entity\Sql\SqlContentEntityStorageSchema::getFieldSchemaIdentifierName()
- 10 core/lib/Drupal/Core/Entity/Sql/SqlContentEntityStorageSchema.php \Drupal\Core\Entity\Sql\SqlContentEntityStorageSchema::getFieldSchemaIdentifierName()
Generates a safe schema identifier (name of an index, column name etc.).
Parameters
string $entity_type_id: The ID of the entity type.
string $field_name: The name of the field.
string|null $key: (optional) A further key to append to the name.
Return value
string The field identifier name.
5 calls to SqlContentEntityStorageSchema::getFieldSchemaIdentifierName()
- SqlContentEntityStorageSchema::addSharedTableFieldForeignKey in core/
lib/ Drupal/ Core/ Entity/ Sql/ SqlContentEntityStorageSchema.php - Adds a foreign key for the specified field to the given schema definition.
- SqlContentEntityStorageSchema::addSharedTableFieldIndex in core/
lib/ Drupal/ Core/ Entity/ Sql/ SqlContentEntityStorageSchema.php - Adds an index for the specified field to the given schema definition.
- SqlContentEntityStorageSchema::addSharedTableFieldUniqueKey in core/
lib/ Drupal/ Core/ Entity/ Sql/ SqlContentEntityStorageSchema.php - Adds a unique key for the specified field to the given schema definition.
- SqlContentEntityStorageSchema::getEntitySchemaData in core/
lib/ Drupal/ Core/ Entity/ Sql/ SqlContentEntityStorageSchema.php - Gets entity schema definitions for index and key definitions.
- SqlContentEntityStorageSchema::getFieldSchemaData in core/
lib/ Drupal/ Core/ Entity/ Sql/ SqlContentEntityStorageSchema.php - Gets field schema data for the given key.
File
-
core/
lib/ Drupal/ Core/ Entity/ Sql/ SqlContentEntityStorageSchema.php, line 1175
Class
- SqlContentEntityStorageSchema
- Defines a schema handler that supports revisionable, translatable entities.
Namespace
Drupal\Core\Entity\SqlCode
protected function getFieldSchemaIdentifierName($entity_type_id, $field_name, $key = NULL) {
$real_key = isset($key) ? "{$entity_type_id}_field__{$field_name}__{$key}" : "{$entity_type_id}_field__{$field_name}";
// Limit the string to 48 characters, keeping a 16 characters margin for db
// prefixes.
if (strlen($real_key) > 48) {
// Use a shorter separator, a truncated entity_type, and a hash of the
// field name.
// Truncate to the same length for the current and revision tables.
$entity_type = substr($entity_type_id, 0, 36);
$field_hash = substr(hash('sha256', $real_key), 0, 10);
$real_key = $entity_type . '__' . $field_hash;
}
return $real_key;
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.