8000 Add explanation when to use QueryBuilder instead of DQL · symfony/symfony-docs@7e3e465 · GitHub
[go: up one dir, main page]

Skip to content

Commit 7e3e465

Browse files
committed
Add explanation when to use QueryBuilder instead of DQL
1 parent 6fc096e commit 7e3e465

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

book/doctrine.rst

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -766,8 +766,10 @@ covered later), group, etc. For more information, see the official
766766
Querying for Objects Using Doctrine's Query Builder
767767
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
768768

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

772774
$repository = $this->getDoctrine()
773775
->getRepository('AppBundle:Product');

0 commit comments

Comments
 (0)
0