Skip to content

Commit 20ba9e0

Browse files
committed
Readded small note about parameters
1 parent 8bb3195 commit 20ba9e0

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

book/doctrine.rst

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -742,6 +742,12 @@ The ``QueryBuilder`` object contains every method necessary to build your
742742
query. By calling the ``getQuery()`` method, the query builder returns a
743743
normal ``Query`` object, which can be used to get the result of the query.
744744

745+
.. tip::
746+
747+
Take note of the ``setParameter()`` method. When working with Doctrine,
748+
it's always a good idea to set any external values as "placeholders"
749+
(``:price`` in the example above) as it prevents SQL injection attacks.
750+
745751
The ``getResult()`` method returns an array of results. To get only one
746752
result, you can use ``getSingleResult()`` (which throws exception there is no
747753
result) or ``getOneOrNullResult()``::

0 commit comments

Comments
 (0)