Skip to content

Impossible to Filter Collection by null Attribute Value #14355

@maxbucknell

Description

@maxbucknell

When loading an EAV collection, such as a product collection, it is impossible to filter a collection by specifying that the value of the attribute is null. This is because the collection generates an INNER JOIN, when it should be generating at least a LEFT JOIN.

I found this issue when researching magento/magento2/14312

Preconditions

This was found on 2.3-develop, and I haven't checked, but my suspicion is that it will fail on all versions of Magento 2.

Steps to reproduce

I have written a failing unit test for this: maxbucknell@b2e2904

Expected result

This query should find the product with the special price of null.

Actual result

Because of the INNER JOIN, $productCount is 0.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Component: EavFixed in 2.3.xThe issue has been fixed in 2.3 release lineIssue: Clear DescriptionGate 2 Passed. Manual verification of the issue description passedIssue: ConfirmedGate 3 Passed. Manual verification of the issue completed. Issue is confirmedIssue: Format is validGate 1 Passed. Automatic verification of issue format passedIssue: Ready for WorkGate 4. Acknowledged. Issue is added to backlog and ready for developmentReproduced on 2.2.xThe issue has been reproduced on latest 2.2 release

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions