Skip to content

Custom admin UI component grid breaks when collection is not AbstractDb #32292

@zaximus84

Description

@zaximus84

Preconditions (*)

  1. Install Magento 2.4.2
  2. Build a custom admin grid using UI components and a data provider.
  3. Use a collection for your data provider that extends Magento\Framework\Data\Collection, but not Magento\Framework\Data\Collection\AbstractDb.

Steps to reproduce (*)

  1. Attempt to view the grid in admin.

Expected result (*)

  1. The grid displays without error.

Actual result (*)

  1. 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”.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Area: FrameworkComponent: Framework/ViewIssue: ConfirmedGate 3 Passed. Manual verification of the issue completed. Issue is confirmedPriority: P2A defect with this priority could have functionality issues which are not to expectations.Progress: ready for devReported on 2.4.2Indicates original Magento version for the Issue report.Reproduced on 2.4.xThe issue has been reproduced on latest 2.4-develop branchTriage: Dev.ExperienceIssue related to Developer Experience and needs help with Triage to Confirm or Reject it

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions