protected SqlContentEntityStorageSchema::getFieldSchemaIdentifierName($entity_type_id, $field_name, $key = NULL)
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.
File
- core/lib/Drupal/Core/Entity/Sql/SqlContentEntityStorageSchema.php, line 716
Class
- SqlContentEntityStorageSchema
- Defines a schema handler that supports revisionable, translatable entities.
Namespace
Drupal\Core\Entity\Sql
Code
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;
}
Please login to continue.