From a0e3eec083d48882f72b23c4692cca45c4bb089a Mon Sep 17 00:00:00 2001 From: Jon Eastman Date: Sat, 21 May 2016 09:21:12 -0500 Subject: [PATCH 1/2] Allowed to return null for query_builder | Q | A | ------------- | --- | Doc fix? | yes | New docs? | no | Applies to | 2.8 | Fixed tickets | #5934 --- reference/forms/types/entity.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/reference/forms/types/entity.rst b/reference/forms/types/entity.rst index 51360ed3c96..31b14c3dc24 100644 --- a/reference/forms/types/entity.rst +++ b/reference/forms/types/entity.rst @@ -202,9 +202,9 @@ query_builder Allows you to create a custom query for your choices. See :ref:`ref-form-entity-query-builder` for an example. -The value of this option can either be a ``QueryBuilder`` object or a Closure. +The value of this option can either be a ``QueryBuilder`` object, a Closure or null. When using a Closure, you will be passed the ``EntityRepository`` of the entity -as the only argument and should return a ``QueryBuilder``. +as the only argument and should return a ``QueryBuilder``. If you'd like to display a list of empty entries, you can return null in the query_builder closure. Overridden Options ------------------ From cff5c063ed4495895ad0b086862f3c8b44b844b8 Mon Sep 17 00:00:00 2001 From: Jon Eastman Date: Sat, 21 May 2016 09:44:26 -0500 Subject: [PATCH 2/2] Updated null tags & line break corrections --- reference/forms/types/entity.rst | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/reference/forms/types/entity.rst b/reference/forms/types/entity.rst index 31b14c3dc24..255c1248566 100644 --- a/reference/forms/types/entity.rst +++ b/reference/forms/types/entity.rst @@ -202,9 +202,10 @@ query_builder Allows you to create a custom query for your choices. See :ref:`ref-form-entity-query-builder` for an example. -The value of this option can either be a ``QueryBuilder`` object, a Closure or null. +The value of this option can either be a ``QueryBuilder`` object, a Closure or ``null``. When using a Closure, you will be passed the ``EntityRepository`` of the entity -as the only argument and should return a ``QueryBuilder``. If you'd like to display a list of empty entries, you can return null in the query_builder closure. +as the only argument and should return a ``QueryBuilder``. +If you'd like to display a list of empty entries, you can return ``null`` in the closure. Overridden Options ------------------