|
@@ -28,9 +28,21 @@ To do:
|
|
|
Customising the query used to generate the list
|
|
|
-----------------------------------------------
|
|
|
|
|
|
-To do:
|
|
|
+You can customize the list query thanks to the ``createQuery`` method.
|
|
|
+
|
|
|
+.. code-block:: php
|
|
|
+
|
|
|
+ <?php
|
|
|
|
|
|
-- how to customize/optimize the list query
|
|
|
+ public function createQuery($context = 'list')
|
|
|
+ {
|
|
|
+ $query = parent::createQuery($context);
|
|
|
+ $query->andWhere(
|
|
|
+ $query->expr()->eq($query->getRootAlias() . '.my_field', ':my_param')
|
|
|
+ );
|
|
|
+ $query->setParameter('my_field', 'my_value');
|
|
|
+ return $query;
|
|
|
+ }
|
|
|
|
|
|
|
|
|
Customising the sort order
|