Failing test for setFetchMode(EAGER) that breaks the loaded collection when custom PK type is used
-
Using eager
setFetchModebreaks fetched collections when certain custom types are used for primary keys.- The collection receives 0 items, but is marked as initialized.
- For int-backed PK types, a PHP Warning is raised from PDO:
-
Object of class CustomId could not be converted to int
-
- The core problem is imo that raw entities are being passed to EntityPersister->loadAll
- This is generally broken in Doctrine ORM when custom PK types are used and one must extract the ids a provide proper ParameterType for those.
Note1: You can simulate the same issue even for string-backed PK types when its __toString() does not 100% match the database value (e.g. using md5 there). Note2: Originally detected by our extensive testcases in shipmonk/doctrine-entity-preloader
If you have a fix proposal, I can even fix the issue. So far, I believe we need to extract identifiers from those entities and use its DbalType::convertToDatabaseValue to fix it properly.
There hasn't been any activity on this pull request in the past 90 days, so it has been marked as stale and it will be closed automatically if no further activity occurs in the next 7 days. If you want to continue working on it, please leave a comment.
Still valid issue.