|
1
|
|
|
<?php |
|
2
|
|
|
/** |
|
3
|
|
|
* Copyright (c) 2019 Lars Roettig |
|
4
|
|
|
* |
|
5
|
|
|
* Permission is hereby granted, free of charge, to any person obtaining a copy |
|
6
|
|
|
* of this software and associated documentation files (the "Software"), to deal |
|
7
|
|
|
* in the Software without restriction, including without limitation the rights |
|
8
|
|
|
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell |
|
9
|
|
|
* copies of the Software, and to permit persons to whom the Software is |
|
10
|
|
|
* furnished to do so, subject to the following conditions: |
|
11
|
|
|
* |
|
12
|
|
|
* The above copyright notice and this permission notice shall be included in all |
|
13
|
|
|
* copies or substantial portions of the Software. |
|
14
|
|
|
* |
|
15
|
|
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
|
16
|
|
|
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
|
17
|
|
|
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE |
|
18
|
|
|
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
|
19
|
|
|
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, |
|
20
|
|
|
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE |
|
21
|
|
|
* SOFTWARE. |
|
22
|
|
|
*/ |
|
23
|
|
|
declare(strict_types=1); |
|
24
|
|
|
|
|
25
|
|
|
namespace LarsRoettig\GraphQLStorePickup\Model\Store; |
|
26
|
|
|
|
|
27
|
|
|
use LarsRoettig\GraphQLStorePickup\Model\ResourceModel\StoreCollection; |
|
28
|
|
|
use LarsRoettig\GraphQLStorePickup\Model\ResourceModel\StoreCollectionFactory; |
|
|
|
|
|
|
29
|
|
|
use Magento\Framework\Api\Search\SearchCriteriaBuilder; |
|
30
|
|
|
use Magento\Framework\Api\SearchCriteria\CollectionProcessorInterface; |
|
31
|
|
|
use Magento\Framework\Api\SearchCriteriaInterface; |
|
32
|
|
|
use Magento\Framework\Api\SearchResultsInterface; |
|
33
|
|
|
use Magento\Framework\Api\SearchResultsInterfaceFactory; |
|
|
|
|
|
|
34
|
|
|
|
|
35
|
|
|
class GetList implements GetListInterface |
|
36
|
|
|
{ |
|
37
|
|
|
/** |
|
38
|
|
|
* @var StoreCollectionFactory |
|
39
|
|
|
*/ |
|
40
|
|
|
private $storeCollectionFactory; |
|
41
|
|
|
/** |
|
42
|
|
|
* @var CollectionProcessorInterface |
|
43
|
|
|
*/ |
|
44
|
|
|
private $collectionProcessor; |
|
45
|
|
|
/** |
|
46
|
|
|
* @var SearchCriteriaBuilder |
|
47
|
|
|
*/ |
|
48
|
|
|
private $searchCriteriaBuilder; |
|
49
|
|
|
/** |
|
50
|
|
|
* @var SearchResultsInterfaceFactory |
|
51
|
|
|
*/ |
|
52
|
|
|
private $storeSearchResultsInterfaceFactory; |
|
53
|
|
|
|
|
54
|
|
|
public function __construct( |
|
55
|
|
|
StoreCollectionFactory $storeCollectionFactory, |
|
56
|
|
|
CollectionProcessorInterface $collectionProcessor, |
|
57
|
|
|
SearchCriteriaBuilder $searchCriteriaBuilder, |
|
58
|
|
|
SearchResultsInterfaceFactory $storeSearchResultsInterfaceFactory |
|
59
|
|
|
) { |
|
60
|
|
|
$this->storeCollectionFactory = $storeCollectionFactory; |
|
61
|
|
|
$this->collectionProcessor = $collectionProcessor; |
|
62
|
|
|
$this->searchCriteriaBuilder = $searchCriteriaBuilder; |
|
63
|
|
|
$this->storeSearchResultsInterfaceFactory = $storeSearchResultsInterfaceFactory; |
|
64
|
|
|
} |
|
65
|
|
|
|
|
66
|
|
|
/** |
|
67
|
|
|
* @param SearchCriteriaInterface|null $searchCriteria |
|
68
|
|
|
* @return SearchResultsInterface |
|
69
|
|
|
*/ |
|
70
|
|
|
public function execute(SearchCriteriaInterface $searchCriteria = null): SearchResultsInterface |
|
71
|
|
|
{ |
|
72
|
|
|
/** @var StoreCollection $storeCollection */ |
|
73
|
|
|
$storeCollection = $this->storeCollectionFactory->create(); |
|
74
|
|
|
if (null === $searchCriteria) { |
|
75
|
|
|
$searchCriteria = $this->searchCriteriaBuilder->create(); |
|
76
|
|
|
} else { |
|
77
|
|
|
$this->collectionProcessor->process($searchCriteria, $storeCollection); |
|
78
|
|
|
} |
|
79
|
|
|
/** @var SearchResultsInterface $searchResult */ |
|
80
|
|
|
$searchResult = $this->storeSearchResultsInterfaceFactory->create(); |
|
81
|
|
|
$searchResult->setItems($storeCollection->getItems()); |
|
82
|
|
|
$searchResult->setTotalCount($storeCollection->getSize()); |
|
83
|
|
|
$searchResult->setSearchCriteria($searchCriteria); |
|
84
|
|
|
|
|
85
|
|
|
return $searchResult; |
|
86
|
|
|
} |
|
87
|
|
|
} |
|
88
|
|
|
|
The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g.
excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths