doctrine / orm

Doctrine Object Relational Mapper (ORM)
https://www.doctrine-project.org/projects/orm.html
MIT License
9.86k stars 2.5k forks source link

Fix eager fetch composite foreign key #11397

Open Brajk19 opened 3 months ago

Brajk19 commented 3 months ago

I think https://github.com/doctrine/orm/pull/11289 did not completely fix problem for eager fetch. Change in that PR checked if primary key of target class is composite but that does not matter when loading collection by foreign key. It should check if foreign key on target class is composite.

Fix from that PR did not work for me because i had entity with regular autogenerated id (single column), but foreign key referenced entity fir composite primary key, like SecondLevelWithoutCompositePrimaryKey in this PR.

Checking if foreign key is composite fixed the problem for me.