Skip to content

Entity Type ID at Join #18131

Closed
Closed
@akimatze

Description

@akimatze

Preconditions

  1. Magento EE 2.2.5
  2. MySQL 5.7, PHP 7.1.14

Steps to reproduce

  1. Create new Entity Type with InstallData Script. Use eav_entity table as entity table with some random attributes.
  2. Create Default EAV Model, ResourceModel and Collection
  3. Use collection, addFieldToSelect of one of the attributes and load them.

Expected result

  1. Entries with added attribute

Actual result

  1. Integrity constraint violation: 1052 Column 'entity_type_id' in where clause is ambiguous, query was: SELECT e.entity_id, t_d.attribute_id, t_d.value FROM eav_entity AS e INNER JOIN eav_entity_varchar AS t_d ON e.entity_id = t_d.entity_id WHERE ( e.entity_id IN (1)) AND (t_d.attribute_id IN ('464')) AND (entity_type_id =12)

Quick fix:

  1. Magento\Eav\Model\Entity\Collection\AbstractCollection.php ~line 1235
  2. Add to $select->where(..) statement: 'e.entity_type_id =?' instead of 'entity_type_id'

Metadata

Metadata

Assignees

Labels

Component: EavFixed 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 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 releaseReproduced on 2.3.xThe issue has been reproduced on latest 2.3 release

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions