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; |
|
|
|
|
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(), '8.3.1') < 0) { |
57
|
|
|
$newConfigs = array( |
58
|
|
|
/* INSERT NEW CONFIGS PARAMS HERE:'config'=>'<value>'*/ |
59
|
|
|
'PAGANTIS_DISPLAY_MAX_AMOUNT' => 0 |
60
|
|
|
); |
61
|
|
|
foreach ($newConfigs as $config => $value) { |
62
|
|
|
$setup->getConnection()->insert(self::CONFIG_TABLE, array('config'=>$config, 'value'=>$value)); |
63
|
|
|
} |
64
|
|
|
} |
65
|
|
|
|
66
|
|
|
if (version_compare($context->getVersion(), '8.3.2') < 0) { |
67
|
|
|
$newConfigs = array( |
68
|
|
|
/* INSERT NEW CONFIGS PARAMS HERE:'config'=>'<value>'*/ |
69
|
|
|
'PAGANTIS_SIMULATOR_DISPLAY_TYPE_CHECKOUT' => 'sdk.simulator.types.CHECKOUT_PAGE' |
70
|
|
|
); |
71
|
|
|
foreach ($newConfigs as $config => $value) { |
72
|
|
|
$setup->getConnection()->insert(self::CONFIG_TABLE, array('config'=>$config, 'value'=>$value)); |
73
|
|
|
} |
74
|
|
|
$setup->getConnection()->update( |
75
|
|
|
self::CONFIG_TABLE, |
76
|
|
|
array('value' => 'sdk.simulator.types.PRODUCT_PAGE'), |
77
|
|
|
"config='PAGANTIS_SIMULATOR_DISPLAY_TYPE'" |
78
|
|
|
); |
79
|
|
|
|
80
|
|
|
} |
81
|
|
|
|
82
|
|
|
$eavSetup = $this->eavSetupFactory->create(['setup' => $setup]); |
83
|
|
|
$eavSetup->addAttribute( |
84
|
|
|
\Magento\Catalog\Model\Product::ENTITY, |
85
|
|
|
$this->code, |
86
|
|
|
[ |
87
|
|
|
'group' => $this->group, |
88
|
|
|
'type' => 'int', |
89
|
|
|
'backend' => '', |
90
|
|
|
'frontend' => '', |
91
|
|
|
'label' => $this->label, |
92
|
|
|
'input' => 'boolean', |
93
|
|
|
'class' => '', |
94
|
|
|
'source' => 'Magento\Eav\Model\Entity\Attribute\Source\Boolean', |
95
|
|
|
'global' => \Magento\Eav\Model\Entity\Attribute\ScopedAttributeInterface::SCOPE_GLOBAL, |
96
|
|
|
'visible' => true, |
97
|
|
|
'required' => false, |
98
|
|
|
'user_defined' => false, |
99
|
|
|
'default' => '0', |
100
|
|
|
'searchable' => false, |
101
|
|
|
'filterable' => false, |
102
|
|
|
'comparable' => false, |
103
|
|
|
'visible_on_front' => false, |
104
|
|
|
'used_in_product_listing' => false, |
105
|
|
|
'unique' => false, |
106
|
|
|
'apply_to' => '' |
107
|
|
|
] |
108
|
|
|
); |
109
|
|
|
|
110
|
|
|
$setup->endSetup(); |
111
|
|
|
} |
112
|
|
|
} |
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