-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Open
Description
When submitting an autocomplete field that uses a UUID as the entity identifier, EasyAdmin throws an error because the Doctrine field mapping is accessed as an object ($idFieldMapping->type).
However, getFieldMapping() returns an array, not an object.
This causes the UUID type check to fail, preventing correct binary conversion and breaking autocomplete submissions for UUID-based entities.
To Reproduce
- Use an entity where the primary key is a UUID field mapped with uuid_binary (Doctrine UuidType).
- Configure an autocomplete field in EasyAdmin referencing this entity.
- Submit the form with a selected autocomplete value.
- EasyAdmin triggers an error similar to:
- Attempt to read property "type" on array
/**
* Gets the mapping of a (regular) field that holds some data but not a
* reference to another object.
*
* @param string $fieldName The field name.
*
* @return mixed[] The field mapping.
* @phpstan-return FieldMapping
*
* @throws MappingException
*/
public function getFieldMapping($fieldName)
{
if (! isset($this->fieldMappings[$fieldName])) {
throw MappingException::mappingNotFound($this->name, $fieldName);
}
return $this->fieldMappings[$fieldName];
}
Expected behavior
EasyAdmin should correctly detect the field type by accessing it as an array:
$idFieldMapping['type']
This allows the UUID to be converted properly:
Uuid::fromString($v)->toBinary();
Metadata
Metadata
Assignees
Labels
No labels