Skip to content

Commit b0627fb

Browse files
committed
Merge remote-tracking branch 'magento-mainline/2.3.1-release' into MC-15085
2 parents c082b36 + 605ec6f commit b0627fb

File tree

5 files changed

+5
-51
lines changed

5 files changed

+5
-51
lines changed

app/code/Magento/Catalog/Model/CategoryList.php

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -76,11 +76,10 @@ public function getList(SearchCriteriaInterface $searchCriteria)
7676
$this->extensionAttributesJoinProcessor->process($collection);
7777

7878
$this->collectionProcessor->process($searchCriteria, $collection);
79-
$collection->load();
8079

8180
$items = [];
82-
foreach ($collection->getItems() as $category) {
83-
$items[] = $this->categoryRepository->get($category->getId());
81+
foreach ($collection->getAllIds() as $id) {
82+
$items[] = $this->categoryRepository->get($id);
8483
}
8584

8685
/** @var CategorySearchResultsInterface $searchResult */

app/code/Magento/Catalog/Test/Unit/Model/CategoryListTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ public function testGetList()
9393

9494
$collection = $this->getMockBuilder(Collection::class)->disableOriginalConstructor()->getMock();
9595
$collection->expects($this->once())->method('getSize')->willReturn($totalCount);
96-
$collection->expects($this->once())->method('getItems')->willReturn([$categoryFirst, $categorySecond]);
96+
$collection->expects($this->once())->method('getAllIds')->willReturn([$categoryIdFirst, $categoryIdSecond]);
9797

9898
$this->collectionProcessorMock->expects($this->once())
9999
->method('process')

app/code/Magento/CatalogGraphQl/Model/Resolver/Products.php

Lines changed: 2 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77

88
namespace Magento\CatalogGraphQl\Model\Resolver;
99

10-
use Magento\Framework\Exception\InputException;
1110
use Magento\Framework\GraphQl\Schema\Type\ResolveInfo;
1211
use Magento\CatalogGraphQl\Model\Resolver\Products\Query\Filter;
1312
use Magento\CatalogGraphQl\Model\Resolver\Products\Query\Search;
@@ -17,7 +16,6 @@
1716
use Magento\Framework\GraphQl\Query\Resolver\Argument\SearchCriteria\SearchFilter;
1817
use Magento\Framework\GraphQl\Query\ResolverInterface;
1918
use Magento\Catalog\Model\Layer\Resolver;
20-
use Magento\Framework\Api\Search\SearchCriteriaInterface;
2119

2220
/**
2321
* Products field resolver, used for GraphQL request processing.
@@ -82,10 +80,10 @@ public function resolve(
8280
} elseif (isset($args['search'])) {
8381
$layerType = Resolver::CATALOG_LAYER_SEARCH;
8482
$this->searchFilter->add($args['search'], $searchCriteria);
85-
$searchResult = $this->getSearchResult($this->searchQuery, $searchCriteria, $info);
83+
$searchResult = $this->searchQuery->getResult($searchCriteria, $info);
8684
} else {
8785
$layerType = Resolver::CATALOG_LAYER_CATEGORY;
88-
$searchResult = $this->getSearchResult($this->filterQuery, $searchCriteria, $info);
86+
$searchResult = $this->filterQuery->getResult($searchCriteria, $info);
8987
}
9088
//possible division by 0
9189
if ($searchCriteria->getPageSize()) {
@@ -117,25 +115,4 @@ public function resolve(
117115

118116
return $data;
119117
}
120-
121-
/**
122-
* Get search result.
123-
*
124-
* @param Filter|Search $query
125-
* @param SearchCriteriaInterface $searchCriteria
126-
* @param ResolveInfo $info
127-
*
128-
* @return \Magento\CatalogGraphQl\Model\Resolver\Products\SearchResult
129-
* @throws GraphQlInputException
130-
*/
131-
private function getSearchResult($query, SearchCriteriaInterface $searchCriteria, ResolveInfo $info)
132-
{
133-
try {
134-
$searchResult = $query->getResult($searchCriteria, $info);
135-
} catch (InputException $e) {
136-
throw new GraphQlInputException(__($e->getMessage()));
137-
}
138-
139-
return $searchResult;
140-
}
141118
}

lib/internal/Magento/Framework/Data/Collection.php

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77

88
use Magento\Framework\Data\Collection\EntityFactoryInterface;
99
use Magento\Framework\Option\ArrayInterface;
10-
use Magento\Framework\Exception\InputException;
1110

1211
/**
1312
* Data collection
@@ -235,20 +234,12 @@ protected function _setIsLoaded($flag = true)
235234
* Get current collection page
236235
*
237236
* @param int $displacement
238-
* @throws \Magento\Framework\Exception\InputException
239237
* @return int
240238
*/
241239
public function getCurPage($displacement = 0)
242240
{
243241
if ($this->_curPage + $displacement < 1) {
244242
return 1;
245-
} elseif ($this->_curPage > $this->getLastPageNumber() && $displacement === 0) {
246-
throw new InputException(
247-
__(
248-
'currentPage value %1 specified is greater than the %2 page(s) available.',
249-
[$this->_curPage, $this->getLastPageNumber()]
250-
)
251-
);
252243
} elseif ($this->_curPage + $displacement > $this->getLastPageNumber()) {
253244
return $this->getLastPageNumber();
254245
} else {

lib/internal/Magento/Framework/Data/Test/Unit/CollectionTest.php

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -144,19 +144,6 @@ public function testGetCurPage()
144144
$this->assertEquals(1, $this->_model->getCurPage());
145145
}
146146

147-
/**
148-
* Test for getCurPage with exception.
149-
*
150-
* @expectedException \Magento\Framework\Exception\StateException
151-
* @return void
152-
*/
153-
public function testGetCurPageWithException()
154-
{
155-
$this->_model->setCurPage(10);
156-
$this->expectException(\Magento\Framework\Exception\InputException::class);
157-
$this->_model->getCurPage();
158-
}
159-
160147
/**
161148
* Test for method possibleFlowWithItem.
162149
*

0 commit comments

Comments
 (0)