@@ -9,6 +9,12 @@ programmatically build queries, and also provides a fluent API.
9
9
This means that you can change between one methodology to the other
10
10
as you want, or just pick a preferred one.
11
11
12
+ .. note ::
13
+
14
+ The ``QueryBuilder `` is not an abstraction of DQL, but merely a tool to dynamically build it.
15
+ You should still use plain DQL when you can, as it is simpler and more readable.
16
+ More about this in the :doc: `FAQ <faq >`_.
17
+
12
18
Constructing a new QueryBuilder object
13
19
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
14
20
@@ -80,7 +86,7 @@ Working with QueryBuilder
80
86
High level API methods
81
87
^^^^^^^^^^^^^^^^^^^^^^
82
88
83
- To simplify even more the way you build a query in Doctrine, you can take
89
+ The most straightforward way to build a dynamic query with the `` QueryBuilder `` is by taking
84
90
advantage of Helper methods. For all base code, there is a set of
85
91
useful methods to simplify a programmer's life. To illustrate how
86
92
to work with them, here is the same example 6 re-written using
@@ -97,10 +103,9 @@ to work with them, here is the same example 6 re-written using
97
103
->orderBy('u.name', 'ASC');
98
104
99
105
``QueryBuilder `` helper methods are considered the standard way to
100
- build DQL queries. Although it is supported, using string-based
101
- queries should be avoided. You are greatly encouraged to use
102
- ``$qb->expr()->* `` methods. Here is a converted example 8 to
103
- suggested standard way to build queries:
106
+ use the ``QueryBuilder ``. The ``$qb->expr()->* `` methods can help you
107
+ build conditional expressions dynamically. Here is a converted example 8 to
108
+ suggested way to build queries with dynamic conditions:
104
109
105
110
.. code-block :: php
106
111
0 commit comments