Open doctrinebot opened 13 years ago
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::walkSelectExpression
somewhere inside this condition like so:
--- a/lib/Doctrine/ORM/Query/SqlWalker.php
+++ b/lib/Doctrine/ORM/Query/SqlWalker.php
@@ -1413,9 +1413,10 @@
default:
// IdentificationVariable or PartialObjectExpression
if ($expr instanceof AST\PartialObjectExpression) {
$dqlAlias = $expr->identificationVariable;
$partialFieldSet = $expr->partialFieldSet;
+ $this->query->setHint(Query::HINT_FORCE_PARTIAL_LOAD, 1);
} else {
$dqlAlias = $expr;
$partialFieldSet = [];
}
seems to do the job fairly well. At least for the most common case of using a partial query.
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