DDC-1465: Fetching partial objects doesn't work if HINT_FORCE_PARTIAL_LOAD is not explicitly used #2094

Open
doctrinebot opened this Issue Nov 2, 2011 · 1 comment

2 participants

@doctrinebot

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 HINTFORCE_PARTIALLOAD must be used as well.

$q = $em->createQuery('SELECT partial r.{id,comment} FROM Entities\Rating r WHERE r.id=3');
$r = $q->getResult() /** HYDRATE_OBJECT is the default hydration mode **/

Here, $r contains the full Entity, a SELECT * has been sent

$q = $em->createQuery('SELECT partial r.{id,comment} FROM Entities\Rating r WHERE r.id=3');
$q->setHint(Doctrine\ORM\Query::HINT*FORCE_PARTIAL*LOAD, 1);

$r = $q->getResult() /** HYDRATE_OBJECT is the default hydration mode **/

Here, $r contains only the selected fields, hence a true partial Entity

@beberlei beberlei was assigned by doctrinebot Dec 6, 2015
@doctrinebot doctrinebot added the Bug label Dec 7, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment