-
Notifications
You must be signed in to change notification settings - Fork 9.4k
Description
Preconditions (*)
- Install Magento 2.4.2
- Build a custom admin grid using UI components and a data provider.
- Use a collection for your data provider that extends Magento\Framework\Data\Collection, but not Magento\Framework\Data\Collection\AbstractDb.
Steps to reproduce (*)
- Attempt to view the grid in admin.
Expected result (*)
- The grid displays without error.
Actual result (*)
- This error occurs: Call to undefined method {custom collection class}::getSelect()
Exception in /var/www/html/vendor/magento/framework/View/Element/UiComponent/DataProvider/FilterPool.php:45
This issue was introduced in 2.4.2 due to changes in the FilterPool class. See this commit: 2638e0f
The applyFilters method type hints that the $collection argument can be an instance of Magento\Framework\Data\Collection or Magento\Framework\Data\Collection\AbstractDb, but the method executes operations that are only guaranteed on AbstractDb (i.e. getSelect).
Any AbstractDb operations should only be executed after some sort of type check to prevent errors for collections that don't extend that abstract. As an example, I built an admin grid that populates data from a remote API and has no need of a database select object, so it doesn't extend AbstractDb.
Please provide Severity assessment for the Issue as Reporter. This information will help during Confirmation and Issue triage processes.
- Severity: S0 - Affects critical data or functionality and leaves users without workaround.
- Severity: S1 - Affects critical data or functionality and forces users to employ a workaround.
- Severity: S2 - Affects non-critical data or functionality and forces users to employ a workaround.
- Severity: S3 - Affects non-critical data or functionality and does not force users to employ a workaround.
- Severity: S4 - Affects aesthetics, professional look and feel, “quality” or “usability”.