1 | <?php |
||||||||
2 | /** |
||||||||
3 | * MagePrince |
||||||||
4 | * |
||||||||
5 | * NOTICE OF LICENSE |
||||||||
6 | * |
||||||||
7 | * This source file is subject to the mageprince.com license that is |
||||||||
8 | * available through the world-wide-web at this URL: |
||||||||
9 | * https://mageprince.com/end-user-license-agreement |
||||||||
10 | * |
||||||||
11 | * DISCLAIMER |
||||||||
12 | * |
||||||||
13 | * Do not edit or add to this file if you wish to upgrade this extension to newer |
||||||||
14 | * version in the future. |
||||||||
15 | * |
||||||||
16 | * @category MagePrince |
||||||||
17 | * @package Mageprince_Faq |
||||||||
18 | * @copyright Copyright (c) MagePrince (https://mageprince.com/) |
||||||||
19 | * @license https://mageprince.com/end-user-license-agreement |
||||||||
20 | */ |
||||||||
21 | |||||||||
22 | namespace Mageprince\Faq\Controller\Adminhtml\FaqGroup; |
||||||||
23 | |||||||||
24 | use Magento\Backend\App\Action; |
||||||||
0 ignored issues
–
show
|
|||||||||
25 | use Magento\Framework\Controller\Result\Json; |
||||||||
0 ignored issues
–
show
The type
Magento\Framework\Controller\Result\Json 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 ![]() |
|||||||||
26 | use Magento\Framework\Controller\Result\JsonFactory; |
||||||||
0 ignored issues
–
show
The type
Magento\Framework\Controller\Result\JsonFactory 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 ![]() |
|||||||||
27 | use Magento\Framework\Controller\ResultInterface; |
||||||||
0 ignored issues
–
show
The type
Magento\Framework\Controller\ResultInterface 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 ![]() |
|||||||||
28 | use Mageprince\Faq\Model\FaqGroupRepository; |
||||||||
29 | |||||||||
30 | class InlineEdit extends Action |
||||||||
31 | { |
||||||||
32 | /** |
||||||||
33 | * @var JsonFactory |
||||||||
34 | */ |
||||||||
35 | protected $jsonFactory; |
||||||||
36 | |||||||||
37 | /** |
||||||||
38 | * @var FaqGroupRepository |
||||||||
39 | */ |
||||||||
40 | protected $faqGroupRepository; |
||||||||
41 | |||||||||
42 | /** |
||||||||
43 | * InlineEdit constructor. |
||||||||
44 | * @param Action\Context $context |
||||||||
45 | * @param JsonFactory $jsonFactory |
||||||||
46 | * @param FaqGroupRepository $faqGroupRepository |
||||||||
47 | */ |
||||||||
48 | public function __construct( |
||||||||
49 | Action\Context $context, |
||||||||
0 ignored issues
–
show
The type
Magento\Backend\App\Action\Context 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 ![]() |
|||||||||
50 | JsonFactory $jsonFactory, |
||||||||
51 | FaqGroupRepository $faqGroupRepository |
||||||||
52 | ) { |
||||||||
53 | $this->jsonFactory = $jsonFactory; |
||||||||
54 | $this->faqGroupRepository = $faqGroupRepository; |
||||||||
55 | parent::__construct($context); |
||||||||
56 | } |
||||||||
57 | |||||||||
58 | /** |
||||||||
59 | * {@inheritdoc} |
||||||||
60 | */ |
||||||||
61 | public function _isAllowed() |
||||||||
62 | { |
||||||||
63 | return $this->_authorization->isAllowed('Mageprince_Faq::FaqGroup'); |
||||||||
64 | } |
||||||||
65 | |||||||||
66 | /** |
||||||||
67 | * Inline edit action |
||||||||
68 | * |
||||||||
69 | * @return ResultInterface |
||||||||
70 | */ |
||||||||
71 | public function execute() |
||||||||
72 | { |
||||||||
73 | /** @var Json $resultJson */ |
||||||||
74 | $resultJson = $this->jsonFactory->create(); |
||||||||
75 | $error = false; |
||||||||
76 | $messages = []; |
||||||||
77 | |||||||||
78 | if ($this->getRequest()->getParam('isAjax')) { |
||||||||
79 | $postItems = $this->getRequest()->getParam('items', []); |
||||||||
80 | if (empty($postItems)) { |
||||||||
81 | $messages[] = __('Please correct the data sent.'); |
||||||||
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
![]() |
|||||||||
82 | $error = true; |
||||||||
83 | } else { |
||||||||
84 | foreach (array_keys($postItems) as $faqGroupId) { |
||||||||
85 | try { |
||||||||
86 | $model = $this->faqGroupRepository->getById($faqGroupId); |
||||||||
87 | $model->setData(array_merge($model->getData(), $postItems[$faqGroupId])); |
||||||||
0 ignored issues
–
show
The method
getData() does not exist on Mageprince\Faq\Api\Data\FaqGroupInterface .
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces. This is most likely a typographical error or the method has been renamed. ![]() The method
setData() does not exist on Mageprince\Faq\Api\Data\FaqGroupInterface .
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces. This is most likely a typographical error or the method has been renamed. ![]() |
|||||||||
88 | $this->faqGroupRepository->save($model); |
||||||||
89 | } catch (\Exception $e) { |
||||||||
90 | $messages[] = "[Faqgroup ID: {$faqGroupId}] {$e->getMessage()}"; |
||||||||
91 | $error = true; |
||||||||
92 | } |
||||||||
93 | } |
||||||||
94 | } |
||||||||
95 | } |
||||||||
96 | |||||||||
97 | return $resultJson->setData([ |
||||||||
98 | 'messages' => $messages, |
||||||||
99 | 'error' => $error |
||||||||
100 | ]); |
||||||||
101 | } |
||||||||
102 | } |
||||||||
103 |
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