Fix autocomplete ids with non-Symfony uid Doctrine types (e.g. ramsey/uuid-doctrine)#7724
Open
bortomar wants to merge 1 commit into
Open
Fix autocomplete ids with non-Symfony uid Doctrine types (e.g. ramsey/uuid-doctrine)#7724bortomar wants to merge 1 commit into
bortomar wants to merge 1 commit into
Conversation
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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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
uuidandulidDoctrine type names can also be claimed by third-party types with a different storage format. A very common setup is ramsey/uuid-doctrine, which registersuuidwith string storage (CHAR(36)):