Skip to content

Specify the table when adding field to filter for the collection Eav/Model/ResourceModel/Entity/Attribute/Option/Collection.php #14572

Closed
@PierreLeMaguer

Description

@PierreLeMaguer
Contributor

Hi!
About the collection vendor/magento/module-eav/Model/ResourceModel/Entity/Attribute/Option/Collection.php, the method setAttribbuteFilter call the method addFieldToFilter without specify the table.
So, when we join some tables with a column 'attribute_id' (example: 'catalog_product_entity_int'), we have the error 'ambiguous column name'.

Preconditions

Magento EE 2.1.12

Steps to reproduce

  1. Create a class with a property Magento\Eav\Model\ResourceModel\Entity\Attribute\Option\CollectionFactory
  2. Create a collection with it and join tables like 'catalog_product_entity_int'
  3. Get items of the collection.

Expected result

  1. Have the items

Actual result

1.error 'ambiguous column name'

a solution would be on the method setAttributeFilter of the class vendor/magento/module-eav/Model/ResourceModel/Entity/Attribute/Option/Collection.php : replace 'return $this->addFieldToFilter('attribute_id', $setId);' by 'return $this->addFieldToFilter('main_table.attribute_id', $setId);'

Activity

orlangur

orlangur commented on Apr 8, 2018

@orlangur
Contributor

@PierreLeMaguer true! setIdFilter already uses similar prefix.

Feel free to propose such doubtless observations directly as a pull request. Could you create one now please? It is possible even via GitHub UI without necessity to clone repository locally.

added
Issue: Clear DescriptionGate 2 Passed. Manual verification of the issue description passed
Issue: ConfirmedGate 3 Passed. Manual verification of the issue completed. Issue is confirmed
on Apr 8, 2018
magento-engcom-team

magento-engcom-team commented on Apr 11, 2018

@magento-engcom-team
Contributor

Hi @PierreLeMaguer. Thank you for your report.
The issue has been fixed in #14596 by @PierreLeMaguer in 2.1-develop branch
Related commit(s):

The fix will be available with the upcoming 2.1.14 release.

magento-engcom-team

magento-engcom-team commented on Apr 11, 2018

@magento-engcom-team
Contributor

Hi @PierreLeMaguer. Thank you for your report.
The issue has been fixed in #14599 by @PierreLeMaguer in 2.2-develop branch
Related commit(s):

The fix will be available with the upcoming 2.2.5 release.

magento-engcom-team

magento-engcom-team commented on Apr 18, 2018

@magento-engcom-team
Contributor

Hi @PierreLeMaguer. Thank you for your report.
The issue has been fixed in #14676 by @rostyslav-hymon in 2.3-develop branch
Related commit(s):

The fix will be available with the upcoming 2.3.0 release.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Fixed in 2.1.xThe issue has been fixed in 2.1 release lineFixed in 2.2.xThe issue has been fixed in 2.2 release lineFixed 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 passed

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      No branches or pull requests

        Participants

        @orlangur@PierreLeMaguer@magento-engcom-team

        Issue actions

          Specify the table when adding field to filter for the collection Eav/Model/ResourceModel/Entity/Attribute/Option/Collection.php · Issue #14572 · magento/magento2