Skip to content

Fix autocomplete ids with non-Symfony uid Doctrine types (e.g. ramsey/uuid-doctrine)#7724

Open
bortomar wants to merge 1 commit into
EasyCorp:4.xfrom
bortomar:fix_ramsey_uuid_autocomplete
Open

Fix autocomplete ids with non-Symfony uid Doctrine types (e.g. ramsey/uuid-doctrine)#7724
bortomar wants to merge 1 commit into
EasyCorp:4.xfrom
bortomar:fix_ramsey_uuid_autocomplete

Conversation

@bortomar

@bortomar bortomar commented Jul 13, 2026

Copy link
Copy Markdown

Fixes #7723.

Bug description

Since 4.27.1 (#7210), CrudAutocompleteSubscriber::preSubmit() converts submitted UUID/ULID values assuming the storage format of the Symfony UID Doctrine types: binary on platforms without a native GUID type (MySQL, MariaDB, SQLite), RFC 4122 otherwise.

However, the uuid and ulid Doctrine type names can also be claimed by third-party types with a different storage format. A very common setup is ramsey/uuid-doctrine, which registers uuid with string storage (CHAR(36)):

doctrine:
    dbal:
        types:
            uuid: 'Ramsey\Uuid\Doctrine\UuidType'

Since 4.27.1, CrudAutocompleteSubscriber converts submitted UUID/ULID
values assuming the storage format of the Symfony UID Doctrine types
(binary on platforms without a native GUID type). However, the 'uuid'
and 'ulid' type names can also be claimed by third-party types with a
different storage format: for example, ramsey/uuid-doctrine registers
'uuid' with string storage, and its convertToDatabaseValue() throws a
ConversionException when it receives the binary value produced by the
subscriber, breaking every form submit of an autocompleted
AssociationField targeting such an entity.

Only convert the submitted values when the registered Doctrine type is
the Symfony UID one; otherwise, pass them through unchanged and let the
registered type convert them when running the query.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant