Skip to content

Commit

Permalink
Clarify some assumptions the object hydration makes.
Browse files Browse the repository at this point in the history
  • Loading branch information
beberlei committed Sep 16, 2017
1 parent 6a86175 commit 0c4f9a8
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions docs/en/reference/dql-doctrine-query-language.rst
Expand Up @@ -1160,6 +1160,22 @@ Object hydration hydrates the result set into the object graph:
$query = $em->createQuery('SELECT u FROM CmsUser u');
$users = $query->getResult(Query::HYDRATE_OBJECT);
Sometimes the behavior in the object hydrator can be confusing, which is
why we are listing as many of the assumptions here for reference:

- Objects fetched in a FROM clause are returned as a Set, that means every
object is only ever included in the resulting array once. This is the case
even when using JOIN or GROUP BY in ways that return the same row for an
object multiple times. If the hydrator sees the same object multiple times,
then it makes sure it is only returned once.

- If an object is already in memory from a previous query of any kind, then
then the previous object is used, even if the database may contain more
recent data. Data from the database is discarded. This even happens if the
previous object is still an unloaded proxy.

This list might be incomplete.

Array Hydration
^^^^^^^^^^^^^^^

Expand Down

0 comments on commit 0c4f9a8

Please sign in to comment.