1 | <?php |
||
2 | |||
3 | namespace Pagantis\Pagantis\Setup; |
||
4 | |||
5 | use Magento\Framework\Setup\UpgradeDataInterface; |
||
6 | use Magento\Framework\Setup\ModuleContextInterface; |
||
7 | use Magento\Framework\Setup\ModuleDataSetupInterface; |
||
8 | use Pagantis\Pagantis\Helper\Config; |
||
9 | use Magento\Eav\Setup\EavSetupFactory; |
||
0 ignored issues
–
show
|
|||
10 | |||
11 | class UpgradeData implements UpgradeDataInterface |
||
12 | { |
||
13 | /** Config tablename */ |
||
14 | const CONFIG_TABLE = 'Pagantis_config'; |
||
15 | |||
16 | /** @var Config */ |
||
17 | public $config; |
||
18 | |||
19 | /** @var string */ |
||
20 | public $code; |
||
21 | |||
22 | /** @var string */ |
||
23 | public $group; |
||
24 | |||
25 | /** @var string */ |
||
26 | public $label; |
||
27 | |||
28 | /** |
||
29 | * @var EavSetupFactory |
||
30 | */ |
||
31 | protected $eavSetupFactory; |
||
32 | |||
33 | /** |
||
34 | * UpgradeData constructor. |
||
35 | * |
||
36 | * @param Config $config |
||
37 | * @param EavSetupFactory $eavSetupFactory |
||
38 | */ |
||
39 | public function __construct(Config $config, EavSetupFactory $eavSetupFactory) |
||
40 | { |
||
41 | $this->config = $config; |
||
42 | $this->code = 'pagantis_promoted'; |
||
43 | $this->group = 'General'; |
||
44 | $this->label = 'Pagantis Promoted'; |
||
45 | $this->eavSetupFactory = $eavSetupFactory; |
||
46 | } |
||
47 | |||
48 | /** |
||
49 | * @param ModuleDataSetupInterface $setup |
||
50 | * @param ModuleContextInterface $context |
||
51 | */ |
||
52 | public function upgrade(ModuleDataSetupInterface $setup, ModuleContextInterface $context) |
||
53 | { |
||
54 | $setup->startSetup(); |
||
55 | |||
56 | if (version_compare($context->getVersion(), '7.2.0') < 0) { |
||
57 | $newConfigs = array( |
||
58 | /* INSERT NEW CONFIGS PARAMS HERE:'config'=>'<config>','value'=>'<value>'*/); |
||
59 | foreach ($newConfigs as $config => $value) { |
||
60 | $setup->getConnection()->insert(self::CONFIG_TABLE, array('config'=>$config, 'value'=>$value)); |
||
61 | } |
||
62 | } |
||
63 | |||
64 | $eavSetup = $this->eavSetupFactory->create(['setup' => $setup]); |
||
65 | $eavSetup->addAttribute( |
||
66 | \Magento\Catalog\Model\Product::ENTITY, |
||
67 | $this->code, |
||
68 | [ |
||
69 | 'group' => $this->group, |
||
70 | 'type' => 'int', |
||
71 | 'backend' => '', |
||
72 | 'frontend' => '', |
||
73 | 'label' => $this->label, |
||
74 | 'input' => 'boolean', |
||
75 | 'class' => '', |
||
76 | 'source' => 'Magento\Eav\Model\Entity\Attribute\Source\Boolean', |
||
77 | 'global' => \Magento\Eav\Model\Entity\Attribute\ScopedAttributeInterface::SCOPE_GLOBAL, |
||
78 | 'visible' => true, |
||
79 | 'required' => false, |
||
80 | 'user_defined' => false, |
||
81 | 'default' => '0', |
||
82 | 'searchable' => false, |
||
83 | 'filterable' => false, |
||
84 | 'comparable' => false, |
||
85 | 'visible_on_front' => false, |
||
86 | 'used_in_product_listing' => false, |
||
87 | 'unique' => false, |
||
88 | 'apply_to' => '' |
||
89 | ] |
||
90 | ); |
||
91 | |||
92 | $setup->endSetup(); |
||
93 | } |
||
94 | } |
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