mirror of
https://github.com/doctrine/orm.git
synced 2026-03-23 22:42:18 +01:00
Relation many-to-one is not hydrated #7528
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 @strauss69400 on GitHub (Jun 26, 2025).
Bug Report
Summary
I am currently migrating an enterprise project from Symfony 3.4 with PHP 7.1 to Symfony 6.4 with PHP 8.2.
The application contains many EntityListeners.
Unfortunately, I’m encountering an issue with the hydration of ManyToOne properties.
Current behavior
I have an entity called "Mails" which contains a "opportunity" property.
In my MailsListener or inside an onFlush event, this property is properly hydrated.
However, the "Opportunity" entity itself also has some ManyToOne relationships, which are not loaded.
For example, the "agent" property is not hydrated.
Expected behavior
With the version 2.5 of Doctrine, The issue does not occur.
How to reproduce
It’s enough to have a second-level entity and access it inside a listener like this:
$entity->getRelation()->getSubRelation();
or
$mail->getOpportunity()->getAgent();