mirror of
https://github.com/doctrine/orm.git
synced 2026-03-23 22:42:18 +01:00
DDC-1465: Fetching partial objects doesn't work if HINT_FORCE_PARTIAL_LOAD is not explicitly used #1837
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 @doctrinebot on GitHub (Nov 2, 2011).
Originally assigned to: @beberlei on GitHub.
Jira issue originally created by user jpauli:
Using the DQL "partial" keyword is not enough to get a partial entity as a result.
The DQL hint HINT_FORCE_PARTIAL_LOAD must be used as well.
Here, $r contains the full Entity, a SELECT * has been sent
Here, $r contains only the selected fields, hence a true partial Entity
@doctrinebot commented on GitHub (Nov 2, 2011):
@Amunak commented on GitHub (Mar 2, 2019):
I have no idea whether this is the correct way to fix this bug as I'm not really familiar with the Doctrine codebase, but adding the query hint to
Doctrine\ORM\Query\SqlWalker::walkSelectExpressionsomewhere inside this condition like so:seems to do the job fairly well. At least for the most common case of using a partial query.