From 7e3e4654d8abd626fad21da438c890c8981e6b44 Mon Sep 17 00:00:00 2001 From: Bocharsky Victor Date: Wed, 19 Aug 2015 12:37:58 +0300 Subject: [PATCH] Add explanation when to use QueryBuilder instead of DQL --- book/doctrine.rst | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/book/doctrine.rst b/book/doctrine.rst index 36c2aa01c26..776125ea512 100644 --- a/book/doctrine.rst +++ b/book/doctrine.rst @@ -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');