Skip to content

Commit d93e5c7

Browse files
committed
MAGETWO-91620: It is not possible to use function setInAllAttributeSetsFilter() together with getAllIds() for class Magento\Catalog\Model\ResourceModel\Product\Attribute\Collection
- Modified having clause to use aggregation function instead of alias
1 parent 0e2bca6 commit d93e5c7

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

app/code/Magento/Eav/Model/ResourceModel/Entity/Attribute/Collection.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -222,7 +222,7 @@ public function setInAllAttributeSetsFilter(array $setIds)
222222
$setIds
223223
)
224224
->group('entity_attribute.attribute_id')
225-
->having('count = ' . count($setIds));
225+
->having(new \Zend_Db_Expr('COUNT(*)') . ' = ' . count($setIds));
226226
}
227227

228228
//$this->getSelect()->distinct(true);

app/code/Magento/Eav/Test/Unit/Model/ResourceModel/Entity/Attribute/CollectionTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,7 @@ public function testSetInAllAttributeSetsFilter()
150150
$this->selectMock->expects($this->atLeastOnce())->method('group')->with('entity_attribute.attribute_id')
151151
->willReturnSelf();
152152

153-
$this->selectMock->expects($this->atLeastOnce())->method('having')->with('count = ' . count($setIds))
153+
$this->selectMock->expects($this->atLeastOnce())->method('having')->with(new \Zend_Db_Expr('COUNT(*)') . ' = ' . count($setIds))
154154
->willReturnSelf();
155155

156156
$this->model->setInAllAttributeSetsFilter($setIds);

0 commit comments

Comments
 (0)