Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Allowed to return null for query_builder#6594

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Closed
JonEastman wants to merge2 commits intosymfony:2.8fromJonEastman:patch-1
Closed
Changes fromall commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletionsreference/forms/types/entity.rst
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -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 ora Closure.
The value of this option can either be a ``QueryBuilder`` object,a Closure or ``null``.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Needs a rebase here when#6596 is merged in 2.8

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

I'll take care of that while merging.

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 closure.
Copy link
Contributor

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 whennull is returned it loads all entities.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

When you set the option tonull, but not when returnnull in the closure, isn't it?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Why that? The only difference is that it's conditional. ?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Ok so I've missed the point of that feature, thanks for the enlightening!

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

@xabbuh Looks likesymfony/symfony@317d30b has not made it to the core !? (neithermaster nor2.8)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Looks like there was something wrong with the commit and it was fixed insymfony/symfony@eb08baa

The tests exists and passes:https://github.com/symfony/symfony/blob/master/src/Symfony/Bridge/Doctrine/Tests/Form/Type/EntityTypeTest.php#L212-L223

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.


Overridden Options
------------------
Expand Down

[8]ページ先頭

©2009-2025 Movatter.jp