File tree Expand file tree Collapse file tree 2 files changed +13
-3
lines changed
app/code/Meta/Catalog/Setup Expand file tree Collapse file tree 2 files changed +13
-3
lines changed Original file line number Diff line number Diff line change 10
10
class MetaCatalogAttributes
11
11
{
12
12
/**
13
+ * Returns array of product attributes to be created
14
+ *
13
15
* @return array[]
14
16
*/
15
17
public function execute (): array
@@ -20,7 +22,7 @@ public function execute(): array
20
22
'type ' => 'varchar ' ,
21
23
'label ' => 'Google Product Category ' ,
22
24
'input ' => 'select ' ,
23
- 'source ' => ' Meta\Catalog\Model\Config\Source\Product\GoogleProductCategory ' ,
25
+ 'source ' => Meta \Catalog \Model \Config \Source \Product \GoogleProductCategory::class ,
24
26
'required ' => false ,
25
27
'sort_order ' => 10 ,
26
28
'global ' => ScopedAttributeInterface::SCOPE_GLOBAL ,
@@ -35,7 +37,7 @@ public function execute(): array
35
37
'type ' => 'int ' ,
36
38
'label ' => 'Sync to Facebook Catalog ' ,
37
39
'input ' => 'boolean ' ,
38
- 'source ' => ' Magento\Eav\Model\Entity\Attribute\Source\Boolean ' ,
40
+ 'source ' => Magento \Eav \Model \Entity \Attribute \Source \Boolean::class ,
39
41
'visible ' => true ,
40
42
'default ' => "1 " ,
41
43
'required ' => false ,
Original file line number Diff line number Diff line change @@ -44,6 +44,8 @@ public function __construct(
44
44
}
45
45
46
46
/**
47
+ * Get dependencies for the data patch
48
+ *
47
49
* @return array
48
50
*/
49
51
public static function getDependencies (): array
@@ -52,6 +54,8 @@ public static function getDependencies(): array
52
54
}
53
55
54
56
/**
57
+ * Get alias for the data patch
58
+ *
55
59
* @return array
56
60
*/
57
61
public function getAliases (): array
@@ -60,6 +64,8 @@ public function getAliases(): array
60
64
}
61
65
62
66
/**
67
+ * Create product attributes
68
+ *
63
69
* @return void
64
70
*/
65
71
public function apply (): void
@@ -88,6 +94,8 @@ public function apply(): void
88
94
}
89
95
90
96
/**
97
+ * Revert the created product attributes
98
+ *
91
99
* @return void
92
100
*/
93
101
public function revert (): void
@@ -97,7 +105,7 @@ public function revert(): void
97
105
/** @var EavSetup $eavSetup */
98
106
$ eavSetup = $ this ->eavSetupFactory ->create (['setup ' => $ this ->moduleDataSetup ]);
99
107
100
- foreach ($ catalogAttributes as $ attributeCode => $ attributeData ) {
108
+ foreach (array_keys ( $ catalogAttributes) as $ attributeCode ) {
101
109
$ eavSetup ->removeAttribute (Product::ENTITY , $ attributeCode );
102
110
}
103
111
You can’t perform that action at this time.
0 commit comments