Skip to content

Update entity.rst #18905

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

Merged
merged 1 commit into from
Sep 26, 2023
Merged

Update entity.rst #18905

merged 1 commit into from
Sep 26, 2023

Conversation

toci-to-ci
Copy link
Contributor

query_builder option - more clear explained

@toci-to-ci toci-to-ci requested a review from xabbuh as a code owner September 20, 2023 11:17
@@ -49,7 +49,7 @@ Using a Custom Query for the Entities

If you want to create a custom query to use when fetching the entities
(e.g. you only want to return some entities, or need to order them), use
the `query_builder`_ option::
the `query_builder`_ option. Please note, that `query_builder` is used to compose data, not fetch real final results::
Copy link
Member

Choose a reason for hiding this comment

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

I am not sure about this change. In the description of the query_builder option we have this:

The value of this option can either be a QueryBuilder object, a callable or null (which will load all entities). When using a callable, you will be passed the EntityRepository of the entity as the only argument and should return a QueryBuilder. Returning null in the Closure will result in loading all entities.

Maybe change this line to something like this:

Suggested change
the `query_builder`_ option. Please note, that `query_builder` is used to compose data, not fetch real final results::
the `query_builder`_ option (which must be a `QueryBuilder` object, a closure returning a `QueryBuilder` object or `null` to load 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.

I like a lot this proposal. @toci-to-ci do you like it too? If this is more clear for you now, we can merge this suggestion. Thanks.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@javiereguiluz There is a lot of questions (stackoverflow ie) WHY error apears when using 'query_builder', PPL are using EntityType in Form same as Repository and fetch data which generate error message. The sugestion of @xabbuch is OK, it is mentioned earlier in documentation how field can act,

I just want to point out, that 'query_builder' is different way to extract (prepare) data than typical EntityRepository

Copy link
Member

Choose a reason for hiding this comment

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

This is now merged. While merging it I reworded as suggested by @xabbuh.

query_builder option - more clear explained
@javiereguiluz javiereguiluz changed the base branch from 6.3 to 5.4 September 26, 2023 10:44
@javiereguiluz javiereguiluz merged commit 29a0b58 into symfony:5.4 Sep 26, 2023
@javiereguiluz
Copy link
Member

Piotr, thanks for this contribution to make docs better.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants