1
0
mirror of synced 2025-02-13 10:49:25 +03:00

Merge pull request #6257 from weaverryan/add-criteria-note

Adding a note about the `Doctrine\ORM\QueryBuilder#addCriteria()` method
This commit is contained in:
Marco Pivetta 2017-01-25 16:56:12 +01:00 committed by GitHub
commit 888f1be7c9
2 changed files with 20 additions and 2 deletions

View File

@ -499,6 +499,24 @@ complete list of supported helper methods available:
public function countDistinct($x); // Returns Expr\Func public function countDistinct($x); // Returns Expr\Func
} }
Adding a Criteria to a Query
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
You can also add a :ref:`Criteria <filtering-collections>` to a QueryBuilder by
using ``addCriteria``:
.. code-block:: php
<?php
use Doctrine\Common\Collections\Criteria;
// ...
$criteria = Criteria::create()
->orderBy(['firstName', 'ASC']);
// $qb instanceof QueryBuilder
$qb->addCriteria($criteria);
// then execute your query like normal
Low Level API Low Level API
^^^^^^^^^^^^^ ^^^^^^^^^^^^^

View File

@ -616,11 +616,11 @@ address reference. When flush is called not only are the references removed
but both the old standing data and the one address entity are also deleted but both the old standing data and the one address entity are also deleted
from the database. from the database.
.. _filtering-collections:
Filtering Collections Filtering Collections
--------------------- ---------------------
.. filtering-collections:
Collections have a filtering API that allows to slice parts of data from Collections have a filtering API that allows to slice parts of data from
a collection. If the collection has not been loaded from the database yet, a collection. If the collection has not been loaded from the database yet,
the filtering API can work on the SQL level to make optimized access to the filtering API can work on the SQL level to make optimized access to