From 2fd48e6a99da3f6283cbad36a9b730b7a23cf767 Mon Sep 17 00:00:00 2001 From: David Verholen Date: Fri, 13 Oct 2017 11:15:46 +0200 Subject: [PATCH 1/3] [BUGFIX][11022] include original search criteria #fixes 11022 --- .../Magento/Catalog/Model/Product/Attribute/SetRepository.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/app/code/Magento/Catalog/Model/Product/Attribute/SetRepository.php b/app/code/Magento/Catalog/Model/Product/Attribute/SetRepository.php index ab6cdb3b464a4..44e99d4f29926 100644 --- a/app/code/Magento/Catalog/Model/Product/Attribute/SetRepository.php +++ b/app/code/Magento/Catalog/Model/Product/Attribute/SetRepository.php @@ -62,6 +62,7 @@ public function save(\Magento\Eav\Api\Data\AttributeSetInterface $attributeSet) */ public function getList(\Magento\Framework\Api\SearchCriteriaInterface $searchCriteria) { + $this->searchCriteriaBuilder->setFilterGroups($searchCriteria->getFilterGroups()); $this->searchCriteriaBuilder->addFilters( [ $this->filterBuilder @@ -71,6 +72,7 @@ public function getList(\Magento\Framework\Api\SearchCriteriaInterface $searchCr ->create(), ] ); + $this->searchCriteriaBuilder->setSortOrders((array)$searchCriteria->getSortOrders()); $this->searchCriteriaBuilder->setCurrentPage($searchCriteria->getCurrentPage()); $this->searchCriteriaBuilder->setPageSize($searchCriteria->getPageSize()); return $this->attributeSetRepository->getList($this->searchCriteriaBuilder->create()); From a85d164f6c08b1fc37fd4df1fbd3c4a8e871749d Mon Sep 17 00:00:00 2001 From: David Verholen Date: Fri, 13 Oct 2017 15:17:23 +0200 Subject: [PATCH 2/3] [BUGFIX][11022] return original search criteria in search result --- .../Model/Product/Attribute/SetRepository.php | 7 ++++++- .../Catalog/Api/AttributeSetRepositoryTest.php | 14 ++------------ 2 files changed, 8 insertions(+), 13 deletions(-) diff --git a/app/code/Magento/Catalog/Model/Product/Attribute/SetRepository.php b/app/code/Magento/Catalog/Model/Product/Attribute/SetRepository.php index 44e99d4f29926..dafa7581253fd 100644 --- a/app/code/Magento/Catalog/Model/Product/Attribute/SetRepository.php +++ b/app/code/Magento/Catalog/Model/Product/Attribute/SetRepository.php @@ -72,10 +72,15 @@ public function getList(\Magento\Framework\Api\SearchCriteriaInterface $searchCr ->create(), ] ); + $this->searchCriteriaBuilder->setSortOrders((array)$searchCriteria->getSortOrders()); $this->searchCriteriaBuilder->setCurrentPage($searchCriteria->getCurrentPage()); $this->searchCriteriaBuilder->setPageSize($searchCriteria->getPageSize()); - return $this->attributeSetRepository->getList($this->searchCriteriaBuilder->create()); + + $searchResult = $this->attributeSetRepository->getList($this->searchCriteriaBuilder->create()); + $searchResult->setSearchCriteria($searchCriteria); + + return $searchResult; } /** diff --git a/dev/tests/api-functional/testsuite/Magento/Catalog/Api/AttributeSetRepositoryTest.php b/dev/tests/api-functional/testsuite/Magento/Catalog/Api/AttributeSetRepositoryTest.php index 5e640390c3231..4f917a9c9961a 100644 --- a/dev/tests/api-functional/testsuite/Magento/Catalog/Api/AttributeSetRepositoryTest.php +++ b/dev/tests/api-functional/testsuite/Magento/Catalog/Api/AttributeSetRepositoryTest.php @@ -165,19 +165,9 @@ public function testGetList() { $searchCriteria = [ 'searchCriteria' => [ - 'filter_groups' => [ - [ - 'filters' => [ - [ - 'field' => 'entity_type_code', - 'value' => 'catalog_product', - 'condition_type' => 'eq', - ], - ], - ], - ], + 'filter_groups' => [], 'current_page' => 1, - 'page_size' => 2, + 'page_size' => 2 ], ]; From 3ec56ac9158f5d344c387f62315696360a12a60d Mon Sep 17 00:00:00 2001 From: David Verholen Date: Fri, 13 Oct 2017 15:18:40 +0200 Subject: [PATCH 3/3] [BUGFIX][11022] typecast filtergroups array --- .../Magento/Catalog/Model/Product/Attribute/SetRepository.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/code/Magento/Catalog/Model/Product/Attribute/SetRepository.php b/app/code/Magento/Catalog/Model/Product/Attribute/SetRepository.php index dafa7581253fd..14774103b8cd2 100644 --- a/app/code/Magento/Catalog/Model/Product/Attribute/SetRepository.php +++ b/app/code/Magento/Catalog/Model/Product/Attribute/SetRepository.php @@ -62,7 +62,7 @@ public function save(\Magento\Eav\Api\Data\AttributeSetInterface $attributeSet) */ public function getList(\Magento\Framework\Api\SearchCriteriaInterface $searchCriteria) { - $this->searchCriteriaBuilder->setFilterGroups($searchCriteria->getFilterGroups()); + $this->searchCriteriaBuilder->setFilterGroups((array)$searchCriteria->getFilterGroups()); $this->searchCriteriaBuilder->addFilters( [ $this->filterBuilder