Partial Doctrine entities

It turns out the solution is really simple. We just need to tell Doctrine of our intentions to fetch just part of the entity, by using the partial DQL keyword.


SELECT partial l{id, title} FROM Log l

Word of warning though: Doctrine will not lazily fetch the omitted fields, like it does for associations. If you skip a field in the DQL query you will have to live without it in this result set.

http://vvv.tobiassjosten.net/doctrine/partial-doctrine-entities/