Skip to content

Commit

Permalink
minor #5637 Add QueryBuilder vs DQL section (bocharsky-bw)
Browse files Browse the repository at this point in the history
This PR was submitted for the master branch but it was merged into the 2.3 branch instead (closes #5637).

Discussion
----------

Add QueryBuilder vs DQL section

Describe difference between QueryBuilder and DQL usage.

| Q             | A
| ------------- | ---
| Doc fix?      | no
| New docs?     | yes
| Applies to    | all
| Fixed tickets | none

Commits
-------

cfc5873 Add explanation when to use QueryBuilder instead of DQL
  • Loading branch information
xabbuh committed Aug 22, 2015
2 parents fdc7f75 + cfc5873 commit c206a57
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 c206a57

Please sign in to comment.