mirror of
https://github.com/doctrine/orm.git
synced 2026-03-24 06:52:09 +01:00
Bidirectional one-to-one relations with multiple join columns break in DQL queries #6162
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 @Ma27 on GitHub (Jan 23, 2019).
Bug Report
Summary
DQL queries including bidirectional one-to-one relations break with an exception as
BasicEntityPersister#loadOneToOneassumes that such relations consist of a single join column sincea360da5a7easClassMetadataInfo#getFieldForColumnbreaks if an association mapping has more than one column.Current behavior
Queries as shown in my failing testcase fail with the following exception on 2.6:
How to reproduce
I created a failing testcase in my fork which passes on
2.5, but fails on2.6.I didn't test it on master as it misses the method
Doctrine\ORM\Persisters\Entity\BasicEntityPersister#loadOneToOneEntity. I assume that 3.0/master is too far diverged from 2.6, so a reproduction on master will be way harder.Expected behavior
That the
$qb->getQuery()->getResult()(see my example) resolves to an entity and doesn't break with an exception.