Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Given a content entity with the following keys:
* entity_keys = {
* "id" = "uuid",
* "label" = "name",
* "uuid" = "uuid",
* },
When SqlContentEntityStorageSchema::getEntitySchema() generates the schema SQL query, it will get the uuid field twice in in inner foreach loop, here:
foreach ($table_mapping->getFieldNames($table_name) as $field_name) {
if (!isset($storage_definitions[$field_name])) {
throw new FieldException("Field storage definition for '$field_name' could not be found.");
}
// Add the schema for base field definitions.
elseif ($table_mapping->allowsSharedTableStorage($storage_definitions[$field_name])) {
$column_names = $table_mapping->getColumnNames($field_name);
$storage_definition = $storage_definitions[$field_name];
$schema[$table_name] = array_merge_recursive($schema[$table_name], $this->getSharedTableFieldSchema($storage_definition, $table_name, $column_names));
}
}
Because of how array_merge_recursive() works, in the schema of the uuid field, the type key will contain an array of two identical items, instead of the proper column type. This causes the type from the generated SQL to be omitted, like this:
CREATE TABLE {foobar} (
`uuid` NOT NULL,
Comments