Closed pribeirojtm closed 4 years ago
I am using createQuery for limiting entities, which user can see/edit/filter etc. (based on custom logic for different entities). Everything works just great, except HelperController->retrieveAutocompleteItemsAction() (used in ModelAutocompleteType) do not call createQuery.
Just wonder - am I using createQuery correctly and should I create PR with bugfix?
Is this still relevant? If so, what is blocking it? Is there anything you can do to help move it forward?
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs.
Hello,
I know we can use this createQuery
method to for example, limiting entities appearing on the list.
But I still have some questions that seems not well clarified in the docs, if someone can help in here:
configureListFields
() regarding the alias used and the columns we can call in the list method must match the alias created by createQuery?I understand that the method exists because sometimes in the list view we are listing many objects, and related objects also, lazyloading entities for each row, making unnecessary queries to database and also consuming a lot of memory resources. That's the purpose of this method, we can customize the query to just make one query to database which populates all the necessary objects for listing. So far so good. This is my understanding of the purpose of this method, to give that possibility.
But what about other contexts? Do we have the same functionality?
Can we improve somehow the docs regarding these explanations?
Thanks in advance.
Since we're dropping the context param in the next major, there won't be some documentation update about this. I recommend you to not rely on this context param.
If you want to filter the export, just uses some filters before clicking on the export button.
Environment
Sonata packages
Symfony packages
PHP version
Subject
This is just a question. From the docs, it seems that this admin method can be overwritten to customize the query used from list view:
Customizing the query used to generate the list
It is meant just for the list? Because I see a param with the $context, but it is deprecated since sf 3.3, and it is removed in 4.0.
Inner question: The query is intimately related with the configureListFields() method, right? We can only use the alias present in the "Select" given by the query. If we don't use createQuery, then we lazyload entities data from the association present in the entity, right?
I understand that the method exists because sometimes in the list view we are listing many objects, and related objects also, lazyloading entities for each row, making unnecessary queries to database and also consuming a lot of memory resources. That's the purpose of this method, we can customize the query to just make one query to database which populates all the necessary objects for listing. So far so good.
And for other contexts, with dont we have the same functionality? Example: Exporting information (the list information) we can have the same type of functionality, because we end in the same problem of the listing. Even for the configureFormFields, we need this kind of helper, because of the lazyloading of many related entities to the main object entity. How can I handle this?
Thanks for your time.