You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
After upgrading from 5.2.0-RC1 to 5.2.0-RC2, choice fields for entities using UUIDs as identifiers will fail validation with an error of "This choice does not exist or is not unique".
I believe this regression is a combination of #39113 changing the column type to BINARY and the query builder trying to use the string representation when querying for them (see #39135 (comment) for a similar issue).
Tracing through the code, DoctrineChoiceLoader calls ORMQueryBuilderLoader::getEntitiesByIds() which returns the matching entity on 5.2.0-RC1 but returns an empty result set on 5.2.0-RC2.
I have replicated this issue on MySQL 5.7 and MariaDB 10.3.
Create a form that exposes the list of these entities:
// NOTE: I'm using EasyAdminBundle for this, but I suspect you'd get the same result with a vanilla Symfony form
public function configureFields(string $pageName): iterable
{
return [
AssociationField::new('foo')->setRequired(true),
// ...
];
}
Then attempt to select the entity from the list, submit the form, and get an error that the choice doesn't exist.
Possible Solutions
Modify the ORMQueryBuilderLoader code to inform Doctrine of the proper field type or convert it to binary beforehand? (untested; based on #39135 (comment)) Or rollback #39113 (probably undesired)
The text was updated successfully, but these errors were encountered:
…derusse)
This PR was merged into the 5.2 branch.
Discussion
----------
[DoctrineBridge] Fix form EntityType with filter on UID
| Q | A
| ------------- | ---
| Branch? | 5.2
| Bug fix? | yes
| New feature? | no
| Deprecations? | no
| Tickets | Fix#39207
| License | MIT
| Doc PR | -
Convert UUID and ULID to the right format in ORMQueryBuilder
/cc @nicolas-grekas
Commits
-------
9e83bb7 Fix form EntotyType with uid
Uh oh!
There was an error while loading. Please reload this page.
Symfony version(s) affected: 5.2.0-RC2
Description
After upgrading from 5.2.0-RC1 to 5.2.0-RC2, choice fields for entities using UUIDs as identifiers will fail validation with an error of "This choice does not exist or is not unique".
I believe this regression is a combination of #39113 changing the column type to
BINARY
and the query builder trying to use the string representation when querying for them (see #39135 (comment) for a similar issue).Tracing through the code,
DoctrineChoiceLoader
callsORMQueryBuilderLoader::getEntitiesByIds()
which returns the matching entity on 5.2.0-RC1 but returns an empty result set on 5.2.0-RC2.I have replicated this issue on MySQL 5.7 and MariaDB 10.3.
How to reproduce
Create an entity with a UUID ID like this:
Create a form that exposes the list of these entities:
Then attempt to select the entity from the list, submit the form, and get an error that the choice doesn't exist.
Possible Solutions
Modify the
ORMQueryBuilderLoader
code to inform Doctrine of the proper field type or convert it to binary beforehand? (untested; based on #39135 (comment)) Or rollback #39113 (probably undesired)The text was updated successfully, but these errors were encountered: