diff --git a/app/code/Magento/Eav/Model/ResourceModel/Entity/Attribute/Collection.php b/app/code/Magento/Eav/Model/ResourceModel/Entity/Attribute/Collection.php index 492da0b72c122..cec415e513677 100644 --- a/app/code/Magento/Eav/Model/ResourceModel/Entity/Attribute/Collection.php +++ b/app/code/Magento/Eav/Model/ResourceModel/Entity/Attribute/Collection.php @@ -222,7 +222,7 @@ public function setInAllAttributeSetsFilter(array $setIds) $setIds ) ->group('entity_attribute.attribute_id') - ->having('count = ' . count($setIds)); + ->having(new \Zend_Db_Expr('COUNT(*)') . ' = ' . count($setIds)); } //$this->getSelect()->distinct(true); diff --git a/app/code/Magento/Eav/Test/Unit/Model/ResourceModel/Entity/Attribute/CollectionTest.php b/app/code/Magento/Eav/Test/Unit/Model/ResourceModel/Entity/Attribute/CollectionTest.php index 138e1363bb6dd..7263637a081d5 100644 --- a/app/code/Magento/Eav/Test/Unit/Model/ResourceModel/Entity/Attribute/CollectionTest.php +++ b/app/code/Magento/Eav/Test/Unit/Model/ResourceModel/Entity/Attribute/CollectionTest.php @@ -150,7 +150,7 @@ public function testSetInAllAttributeSetsFilter() $this->selectMock->expects($this->atLeastOnce())->method('group')->with('entity_attribute.attribute_id') ->willReturnSelf(); - $this->selectMock->expects($this->atLeastOnce())->method('having')->with('count = ' . count($setIds)) + $this->selectMock->expects($this->atLeastOnce())->method('having')->with(new \Zend_Db_Expr('COUNT(*)') . ' = ' . count($setIds)) ->willReturnSelf(); $this->model->setInAllAttributeSetsFilter($setIds);