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\Model\Faq; |
||
23 | |||
24 | use Magento\Framework\App\Request\DataPersistorInterface; |
||
0 ignored issues
–
show
|
|||
25 | use Magento\Ui\DataProvider\AbstractDataProvider; |
||
0 ignored issues
–
show
The type
Magento\Ui\DataProvider\AbstractDataProvider 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 Mageprince\Faq\Model\ResourceModel\Faq\CollectionFactory; |
||
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 ![]() |
|||
27 | |||
28 | class DataProvider extends AbstractDataProvider |
||
29 | { |
||
30 | /** |
||
31 | * @var array |
||
32 | */ |
||
33 | private $loadedData; |
||
34 | |||
35 | /** |
||
36 | * @var DataPersistorInterface |
||
37 | */ |
||
38 | private $dataPersistor; |
||
39 | |||
40 | /** |
||
41 | * @var CollectionFactory |
||
42 | */ |
||
43 | public $collection; |
||
44 | |||
45 | /** |
||
46 | * DataProvider constructor. |
||
47 | * @param string $name |
||
48 | * @param string $primaryFieldName |
||
49 | * @param string $requestFieldName |
||
50 | * @param CollectionFactory $collectionFactory |
||
51 | * @param DataPersistorInterface $dataPersistor |
||
52 | * @param array $meta |
||
53 | * @param array $data |
||
54 | */ |
||
55 | public function __construct( |
||
56 | $name, |
||
57 | $primaryFieldName, |
||
58 | $requestFieldName, |
||
59 | CollectionFactory $collectionFactory, |
||
60 | DataPersistorInterface $dataPersistor, |
||
61 | array $meta = [], |
||
62 | array $data = [] |
||
63 | ) { |
||
64 | $this->collection = $collectionFactory->create(); |
||
65 | $this->dataPersistor = $dataPersistor; |
||
66 | parent::__construct($name, $primaryFieldName, $requestFieldName, $meta, $data); |
||
67 | } |
||
68 | |||
69 | /** |
||
70 | * Get data |
||
71 | * |
||
72 | * @return array |
||
73 | */ |
||
74 | public function getData() |
||
75 | { |
||
76 | if (isset($this->loadedData)) { |
||
77 | return $this->loadedData; |
||
78 | } |
||
79 | $items = $this->collection->getItems(); |
||
80 | foreach ($items as $model) { |
||
81 | $this->loadedData[$model->getId()] = $model->getData(); |
||
82 | } |
||
83 | $data = $this->dataPersistor->get('mageprince_faq_faq'); |
||
84 | |||
85 | if (!empty($data)) { |
||
86 | $model = $this->collection->getNewEmptyItem(); |
||
87 | $model->setData($data); |
||
88 | $this->loadedData[$model->getId()] = $model->getData(); |
||
89 | $this->dataPersistor->clear('mageprince_faq_faq'); |
||
90 | } |
||
91 | |||
92 | return $this->loadedData; |
||
93 | } |
||
94 | } |
||
95 |
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