-
-
Notifications
You must be signed in to change notification settings - Fork 5.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Allowed to return null for query_builder #6594
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. as we're in the Can you please also put |
||
|
||
Overridden Options | ||
------------------ | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
unless I'm missing something, it's not the option value that can be
null
. Instead, the closure can return null.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@wouterj see https://github.com/symfony/symfony/blob/2.3/src/Symfony/Bridge/Doctrine/Form/Type/DoctrineType.php#L167 and https://github.com/symfony/symfony/blob/2.7/src/Symfony/Bridge/Doctrine/Form/Type/EntityType.php#L43 but this change should be done in 2.3 though