Skip to content

Commit 162e54b

Browse files
ENGCOM-5499: class ApplyAttributesUpdate should use \Magento\Catalog\Model\Product\Type::TYPE_BUNDLE instead of fixing 'bundle' #23919
- Merge Pull Request #23919 from edenduong/magento2:2.3-refactor/apply_attributes_update_constant - Merged commits: 1. 4006f70 2. 83963ee
2 parents 80ae9bd + 83963ee commit 162e54b

File tree

1 file changed

+13
-14
lines changed

1 file changed

+13
-14
lines changed

app/code/Magento/Bundle/Setup/Patch/Data/ApplyAttributesUpdate.php

Lines changed: 13 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,7 @@
1414
use Magento\Eav\Setup\EavSetupFactory;
1515

1616
/**
17-
* Class ApplyAttributesUpdate
18-
* @package Magento\Bundle\Setup\Patch
17+
* Class \Magento\Bundle\Setup\Patch\ApplyAttributesUpdate
1918
*/
2019
class ApplyAttributesUpdate implements DataPatchInterface, PatchVersionInterface
2120
{
@@ -44,7 +43,7 @@ public function __construct(
4443
}
4544

4645
/**
47-
* {@inheritdoc}
46+
* @inheritdoc
4847
* @SuppressWarnings(PHPMD.ExcessiveMethodLength)
4948
*/
5049
public function apply()
@@ -66,8 +65,8 @@ public function apply()
6665
',',
6766
$eavSetup->getAttribute(\Magento\Catalog\Model\Product::ENTITY, $field, 'apply_to')
6867
);
69-
if (!in_array('bundle', $applyTo)) {
70-
$applyTo[] = 'bundle';
68+
if (!in_array(\Magento\Catalog\Model\Product\Type::TYPE_BUNDLE, $applyTo)) {
69+
$applyTo[] = \Magento\Catalog\Model\Product\Type::TYPE_BUNDLE;
7170
$eavSetup->updateAttribute(
7271
\Magento\Catalog\Model\Product::ENTITY,
7372
$field,
@@ -78,7 +77,7 @@ public function apply()
7877
}
7978

8079
$applyTo = explode(',', $eavSetup->getAttribute(\Magento\Catalog\Model\Product::ENTITY, 'cost', 'apply_to'));
81-
unset($applyTo[array_search('bundle', $applyTo)]);
80+
unset($applyTo[array_search(\Magento\Catalog\Model\Product\Type::TYPE_BUNDLE, $applyTo)]);
8281
$eavSetup->updateAttribute(\Magento\Catalog\Model\Product::ENTITY, 'cost', 'apply_to', implode(',', $applyTo));
8382

8483
/**
@@ -106,7 +105,7 @@ public function apply()
106105
'visible_on_front' => false,
107106
'used_in_product_listing' => true,
108107
'unique' => false,
109-
'apply_to' => 'bundle'
108+
'apply_to' => \Magento\Catalog\Model\Product\Type::TYPE_BUNDLE
110109
]
111110
);
112111

@@ -131,7 +130,7 @@ public function apply()
131130
'comparable' => false,
132131
'visible_on_front' => false,
133132
'unique' => false,
134-
'apply_to' => 'bundle'
133+
'apply_to' => \Magento\Catalog\Model\Product\Type::TYPE_BUNDLE
135134
]
136135
);
137136

@@ -157,7 +156,7 @@ public function apply()
157156
'visible_on_front' => false,
158157
'used_in_product_listing' => true,
159158
'unique' => false,
160-
'apply_to' => 'bundle'
159+
'apply_to' => \Magento\Catalog\Model\Product\Type::TYPE_BUNDLE
161160
]
162161
);
163162

@@ -184,7 +183,7 @@ public function apply()
184183
'visible_on_front' => false,
185184
'used_in_product_listing' => true,
186185
'unique' => false,
187-
'apply_to' => 'bundle'
186+
'apply_to' => \Magento\Catalog\Model\Product\Type::TYPE_BUNDLE
188187
]
189188
);
190189

@@ -210,29 +209,29 @@ public function apply()
210209
'visible_on_front' => false,
211210
'used_in_product_listing' => true,
212211
'unique' => false,
213-
'apply_to' => 'bundle'
212+
'apply_to' => \Magento\Catalog\Model\Product\Type::TYPE_BUNDLE
214213
]
215214
);
216215
}
217216

218217
/**
219-
* {@inheritdoc}
218+
* @inheritdoc
220219
*/
221220
public static function getDependencies()
222221
{
223222
return [];
224223
}
225224

226225
/**
227-
* {@inheritdoc}
226+
* @inheritdoc
228227
*/
229228
public static function getVersion()
230229
{
231230
return '2.0.0';
232231
}
233232

234233
/**
235-
* {@inheritdoc}
234+
* @inheritdoc
236235
*/
237236
public function getAliases()
238237
{

0 commit comments

Comments
 (0)