-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
Added Query Hints support to Entity form type that use query builder #8378
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
Conversation
@@ -39,7 +46,7 @@ class ORMQueryBuilderLoader implements EntityLoaderInterface | |||
* | |||
* @throws UnexpectedTypeException | |||
*/ | |||
public function __construct($queryBuilder, $manager = null, $class = null) | |||
public function __construct($queryBuilder, $manager = null, $class = null, $hints = 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.
Why not array $hints = array()
?
@beberlei Can you please have a look at this PR? Thanks. |
@Tii use can use the 'choice_list' option with a SimpleChoiceList instance populated with data fetched from a repository function. This is not an exact equivalent of what this PR achieves, and cannot be used in every situation, but it's what I've been using so far on my project. |
What's the status of this PR? @tiagojsag Can you finish it? |
I am not sure this feature is warranted. Granted you can set query hints, but then again you can also configure 1 million other things on the Query object, are we to add those as well? Setting query hints is a 10% not a 90% feature (and I would argue the percentage is even lower). I would rather extract the QueryBuilder/Query creation into a protected method as part of this PR to make the API of ORM loader more easily extendable and then suggest/document to overwrite the loader, which is easily done in the entity type using in believe the 'loader' option. |
I think to extend the default loader closure to use a new I don't know if it's the best move. It may be better to merge both use case in the |
Adds an optional "query_hints" array to be passed to "entity" form types, to be used when generating the Query object to retrieve objects from storage.
I've added a basic test, that just validates the scenario where the input type for the "query_hints" is incorrect. I wanted to add a test to validate the working scenario, but my phpunit/doctrine knowledge only goes so far, so if anyone could give me a help with it, I'd really appreciate.