Skip to content

Commit

Permalink
Add explanation when to use QueryBuilder instead of DQL
Browse files Browse the repository at this point in the history
  • Loading branch information
bocharsky-bw authored and xabbuh committed Aug 22, 2015
1 parent fdc7f75 commit cfc5873
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions book/doctrine.rst
Original file line number Diff line number Diff line change
Expand Up @@ -766,8 +766,10 @@ covered later), group, etc. For more information, see the official
Querying for Objects Using Doctrine's Query Builder
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Instead of writing a DQL string, you can alternatively use a helpful object called
the ``QueryBuilder`` to build that string for you::
Instead of writing a DQL string, you can use a helpful object called the
``QueryBuilder`` to build that string for you. This is useful when the actual query
depends on dynamic conditions, as your code soon becomes hard to read with
DQL as you start to concatenate strings::

$repository = $this->getDoctrine()
->getRepository('AppBundle:Product');
Expand Down

0 comments on commit cfc5873

Please sign in to comment.