mirror of
https://github.com/doctrine/orm.git
synced 2026-03-23 22:42:18 +01:00
doctrine 2 LAZY one-to-one fetching of association no working in reverse side #6035
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 @INHack20 on GitHub (Aug 14, 2018).
Originally assigned to: @Ocramius on GitHub.
Bug Report
When performing a relation of the reverse side and obtaining the entity from the database, the query of the elements declared in the one-to-one relationship is executed.
Option EXTRA_LAZY nor LAZY does not work.
Declare:
/**
* @var Balance
* @ORM\OneToOne(targetEntity="Balance",mappedBy="digitalAccount",fetch="LAZY")
*/
protected $balance;
and
Summary
When you obtain DigitalAccount entity, you automatically get $ balance automatically without calling getBalance ()
Current behavior
How to reproduce
Declare one-to-one in reverse side is the error.
Expected behavior
No additional query to call the getBalance () method as it works on the owner side.
@Ocramius commented on GitHub (Aug 15, 2018):
In one-to-one associations, the owning side must always be loaded in memory: this is intentional/by design.
@INHack20 commented on GitHub (Aug 15, 2018):
Thanks!