-
Notifications
You must be signed in to change notification settings - Fork 2.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix enum IDs in association mappings #10274
Conversation
114beb9
to
20d6c53
Compare
@greg0ire please review, this fixes a very specific case where we are using complex associations to entities with one or more ID columns, one of which is an enum. My original thought was to use identifierFlattener like this: $associatedIdFlattened = $this->identifierFlattener->flattenIdentifier($targetClass, $associatedId);
$relatedIdHash = implode(' ', $associatedIdFlattened); here - orm/lib/Doctrine/ORM/UnitOfWork.php Line 2850 in 20d6c53
But when running tests, this created some issues and BC breaks. I this this fix is sufficient. Other cases (like a single enum ID not part of association) already use checks like this |
Please squash your commits together and use a commit message as good as this one: 9d5ab4c |
In your test, all 3 entities have the enum appear in the primary key, is that required to reproduce the issue? |
cf726a3
to
e3076eb
Compare
It is not required, but I did like the complex structure of the example as it works through 2 levels of association instead of just one. |
Enum fields as ID have worked for some time, but referencing these fields from other entities in association mappings such as OneToOne, ManyToOne and ManyToMany resulted in fatal error as there was an attempt to convert enum value to string improperly.
e3076eb
to
d5a6b36
Compare
I have reduced the example entity to a minimum and provided a nice commit message. @greg0ire please review |
Thanks @michnovka ! |
Attempt to fix #10132