mirror of
https://github.com/doctrine/orm.git
synced 2026-03-23 22:42:18 +01:00
2.13.2 - 2.13.3 | Enum column - Object of class x could not be converted to x #7046
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @ThomasGoffart on GitHub (Sep 26, 2022).
Bug Report
Summary
When having an enum column like this:
This error occurred when you load the entity from a query from the Query Builder (repository):
Workaround
Downgrade
doctrine/ormto 2.13.1 version while waiting for a fix.@michnovka commented on GitHub (Sep 26, 2022):
This is also likely to be fixed with https://github.com/doctrine/orm/pull/10058 . Please confirm
@NotionCommotion commented on GitHub (Sep 26, 2022):
I am getting the same error, and when I comment out
$this->rsm->addEnumResult($columnAlias, $mapping['enumType']);on line number 1525 added by this commit, I no longer get the error.Note that for my case, Doctrine tries to typecast
PermissionEnumto an integerresulting in error
Warning: Object of class App\\Entity\AccessControl\Acl\PermissionEnum could not be converted to int.However, as shown below,
PermissionEnumis never intended to be directly persisted in the database but only as a subpart inPermission.@derrabus commented on GitHub (Sep 27, 2022):
@NotionCommotion Please provide a small application or a functional test case that reproduces your issue.
@kshtompel commented on GitHub (Sep 27, 2022):
I see fix of this issue in this commit
d69a0fa2cfbut it was not released as 2.13.3
when to expect the release?
@devtronic commented on GitHub (Sep 28, 2022):
See also #10057
@NotionCommotion commented on GitHub (Sep 28, 2022):
@derrabus I spent about 4 hours yesterday trying to isolate the issue so I may provide it, but was unsuccessful. Didn't try everything such as checking whether some 3rd party app such as doctrine extensions is also involved. Any thoughts how one best troubleshoots and isolates issues such as this?
@kshtompel commented on GitHub (Oct 9, 2022):
@ThomasGoffart is it resolved now?
@greg0ire commented on GitHub (Oct 9, 2022):
Let me know if it is not resolved and I will reopen this.
@ThomasGoffart commented on GitHub (Oct 11, 2022):
This issue is still on my side (
doctrine/ormv2.13.3 )@michnovka commented on GitHub (Oct 11, 2022):
Can you please provide your
Colorenum definition?@ThomasGoffart commented on GitHub (Oct 11, 2022):
This error occurs with a classic enum.
Here is a common example of enum that causes this problem.
@michnovka commented on GitHub (Oct 11, 2022):
Just out of curiosity, when using
stringbacked enums, can you also reproduce the issue?@ThomasGoffart commented on GitHub (Oct 11, 2022):
Yes, I tested it and it also happens.
@michnovka commented on GitHub (Oct 11, 2022):
Do these tests you submitted fail - https://github.com/doctrine/orm/pull/10111 ?
If they do not, can you please push PR with failing tests? I will work on it then.