1 | <?php |
||||
2 | |||||
3 | namespace Mageprince\Faq\Model\Resolver; |
||||
4 | |||||
5 | use Magento\Framework\Data\Collection as AbstractDbCollection; |
||||
0 ignored issues
–
show
|
|||||
6 | use Magento\Framework\GraphQl\Config\Element\Field; |
||||
0 ignored issues
–
show
The type
Magento\Framework\GraphQl\Config\Element\Field was not found. Maybe you did not declare it correctly or list all dependencies?
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. filter:
dependency_paths: ["lib/*"]
For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths ![]() |
|||||
7 | use Magento\Framework\GraphQl\Exception\GraphQlInputException; |
||||
0 ignored issues
–
show
The type
Magento\Framework\GraphQ...n\GraphQlInputException was not found. Maybe you did not declare it correctly or list all dependencies?
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. filter:
dependency_paths: ["lib/*"]
For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths ![]() |
|||||
8 | use Magento\Framework\GraphQl\Query\ResolverInterface; |
||||
0 ignored issues
–
show
The type
Magento\Framework\GraphQl\Query\ResolverInterface was not found. Maybe you did not declare it correctly or list all dependencies?
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. filter:
dependency_paths: ["lib/*"]
For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths ![]() |
|||||
9 | use Magento\Framework\GraphQl\Schema\Type\ResolveInfo; |
||||
0 ignored issues
–
show
The type
Magento\Framework\GraphQl\Schema\Type\ResolveInfo was not found. Maybe you did not declare it correctly or list all dependencies?
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. filter:
dependency_paths: ["lib/*"]
For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths ![]() |
|||||
10 | use Mageprince\Faq\Model\ResourceModel\Faq\CollectionFactory as FaqCollectionFactory; |
||||
0 ignored issues
–
show
The type
Mageprince\Faq\Model\Res...l\Faq\CollectionFactory was not found. Maybe you did not declare it correctly or list all dependencies?
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. filter:
dependency_paths: ["lib/*"]
For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths ![]() |
|||||
11 | |||||
12 | class Faq implements ResolverInterface |
||||
13 | { |
||||
14 | /** |
||||
15 | * @var FaqCollectionFactory |
||||
16 | */ |
||||
17 | protected $faqCollectionFactory; |
||||
18 | |||||
19 | /** |
||||
20 | * Faq constructor. |
||||
21 | * @param FaqCollectionFactory $faqCollectionFactory |
||||
22 | */ |
||||
23 | public function __construct( |
||||
24 | FaqCollectionFactory $faqCollectionFactory |
||||
25 | ) { |
||||
26 | $this->faqCollectionFactory = $faqCollectionFactory; |
||||
27 | } |
||||
28 | |||||
29 | /** |
||||
30 | * @inheritdoc |
||||
31 | */ |
||||
32 | public function resolve( |
||||
33 | Field $field, |
||||
34 | $context, |
||||
35 | ResolveInfo $info, |
||||
36 | array $value = null, |
||||
37 | array $args = null |
||||
38 | ) { |
||||
39 | if (isset($args['pageSize']) && $args['pageSize'] < 1) { |
||||
40 | throw new GraphQlInputException(__('pageSize value must be greater than 0.')); |
||||
0 ignored issues
–
show
The function
__ was not found. Maybe you did not declare it correctly or list all dependencies?
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
![]() |
|||||
41 | } |
||||
42 | |||||
43 | if (isset($args['currentPage']) && $args['currentPage'] < 1) { |
||||
44 | throw new GraphQlInputException(__('currentPage value must be greater than 0.')); |
||||
45 | } |
||||
46 | |||||
47 | /** @var \Mageprince\Faq\Model\ResourceModel\Faq\Collection $faqCollection */ |
||||
48 | $faqCollection = $this->faqCollectionFactory->create(); |
||||
49 | |||||
50 | if (!empty($args['groupId'])) { |
||||
51 | $faqCollection->addFieldToFilter( |
||||
52 | 'group', |
||||
53 | [ |
||||
54 | ['null' => true], |
||||
55 | ['finset' => $args['groupId']] |
||||
56 | ] |
||||
57 | ); |
||||
58 | } |
||||
59 | |||||
60 | $faqCollection->addFieldToFilter('status', 1); |
||||
61 | $faqCollection->setOrder('sortorder', AbstractDbCollection::SORT_ORDER_ASC); |
||||
62 | |||||
63 | if (isset($args['pageSize'])) { |
||||
64 | $faqCollection->setPageSize($args['pageSize']); |
||||
65 | } |
||||
66 | |||||
67 | if (isset($args['currentPage'])) { |
||||
68 | $faqCollection->setCurPage($args['currentPage']); |
||||
69 | } |
||||
70 | |||||
71 | return $faqCollection->getData(); |
||||
72 | } |
||||
73 | } |
||||
74 |
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