Skip to content

Commit 7c29f6f

Browse files
author
Valeriy Nayda
committed
Merge remote-tracking branch 'mainline/develop' into MAGETWO-62271
# Conflicts: # dev/tests/functional/tests/app/Magento/CatalogInventoryConfigurableProduct/Test/TestCase/CreateConfigurableProductEntityTest.xml
2 parents 679219d + f5c8add commit 7c29f6f

File tree

37 files changed

+856
-851
lines changed

37 files changed

+856
-851
lines changed

app/code/Magento/Catalog/Setup/UpgradeData.php

Lines changed: 43 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,7 @@
55
*/
66
namespace Magento\Catalog\Setup;
77

8-
use Magento\Catalog\Api\Data\ProductAttributeInterface;
9-
use Magento\Eav\Model\Entity\Attribute\ScopedAttributeInterface;
108
use Magento\Eav\Setup\EavSetup;
11-
use Magento\Eav\Setup\EavSetupFactory;
129
use Magento\Framework\Setup\ModuleContextInterface;
1310
use Magento\Framework\Setup\ModuleDataSetupInterface;
1411
use Magento\Framework\Setup\UpgradeDataInterface;
@@ -30,7 +27,7 @@ class UpgradeData implements UpgradeDataInterface
3027
/**
3128
* EAV setup factory
3229
*
33-
* @var EavSetupFactory
30+
* @var \Magento\Eav\Setup\EavSetupFactory
3431
*/
3532
private $eavSetupFactory;
3633

@@ -43,12 +40,12 @@ class UpgradeData implements UpgradeDataInterface
4340
* Constructor
4441
*
4542
* @param CategorySetupFactory $categorySetupFactory
46-
* @param EavSetupFactory $eavSetupFactory
43+
* @param \Magento\Eav\Setup\EavSetupFactory $eavSetupFactory
4744
* @param UpgradeWidgetData $upgradeWidgetData
4845
*/
4946
public function __construct(
5047
CategorySetupFactory $categorySetupFactory,
51-
EavSetupFactory $eavSetupFactory,
48+
\Magento\Eav\Setup\EavSetupFactory $eavSetupFactory,
5249
UpgradeWidgetData $upgradeWidgetData
5350
) {
5451
$this->categorySetupFactory = $categorySetupFactory;
@@ -100,7 +97,7 @@ public function upgrade(ModuleDataSetupInterface $setup, ModuleContextInterface
10097

10198
if (version_compare($context->getVersion(), '2.0.2') < 0) {
10299
// set new resource model paths
103-
/** @var \Magento\Catalog\Setup\CategorySetup $categorySetup */
100+
/** @var CategorySetup $categorySetup */
104101
$categorySetup = $this->categorySetupFactory->create(['setup' => $setup]);
105102
$categorySetup->updateEntityType(
106103
\Magento\Catalog\Model\Category::ENTITY,
@@ -141,69 +138,72 @@ public function upgrade(ModuleDataSetupInterface $setup, ModuleContextInterface
141138
}
142139

143140
if (version_compare($context->getVersion(), '2.0.3') < 0) {
144-
/** @var \Magento\Catalog\Setup\CategorySetup $categorySetup */
141+
/** @var CategorySetup $categorySetup */
145142
$categorySetup = $this->categorySetupFactory->create(['setup' => $setup]);
146143
$categorySetup->updateAttribute(3, 54, 'default_value', 1);
147144
}
148145

149146
if (version_compare($context->getVersion(), '2.0.4') < 0) {
150-
/** @var \Magento\Catalog\Setup\CategorySetup $categorySetup */
147+
$mediaBackendType = 'static';
148+
$mediaBackendModel = null;
149+
/** @var CategorySetup $categorySetup */
151150
$categorySetup = $this->categorySetupFactory->create(['setup' => $setup]);
152151
$categorySetup->updateAttribute(
153152
'catalog_product',
154153
'media_gallery',
155154
'backend_type',
156-
'static'
155+
$mediaBackendType
157156
);
158157
$categorySetup->updateAttribute(
159158
'catalog_product',
160159
'media_gallery',
161-
'backend_model'
160+
'backend_model',
161+
$mediaBackendModel
162162
);
163163
}
164164

165165
if (version_compare($context->getVersion(), '2.0.5', '<')) {
166-
/** @var \Magento\Catalog\Setup\CategorySetup $categorySetup */
166+
/** @var CategorySetup $categorySetup */
167167
$categorySetup = $this->categorySetupFactory->create(['setup' => $setup]);
168168

169169
//Product Details tab
170170
$categorySetup->updateAttribute(
171-
ProductAttributeInterface::ENTITY_TYPE_CODE,
171+
\Magento\Catalog\Model\Product::ENTITY,
172172
'status',
173173
'frontend_label',
174174
'Enable Product',
175175
5
176176
);
177177
$categorySetup->updateAttribute(
178-
ProductAttributeInterface::ENTITY_TYPE_CODE,
178+
\Magento\Catalog\Model\Product::ENTITY,
179179
'name',
180180
'frontend_label',
181181
'Product Name'
182182
);
183-
$attributeSetId = $categorySetup->getDefaultAttributeSetId(ProductAttributeInterface::ENTITY_TYPE_CODE);
183+
$attributeSetId = $categorySetup->getDefaultAttributeSetId(\Magento\Catalog\Model\Product::ENTITY);
184184
$categorySetup->addAttributeToGroup(
185-
ProductAttributeInterface::ENTITY_TYPE_CODE,
185+
\Magento\Catalog\Model\Product::ENTITY,
186186
$attributeSetId,
187187
'Product Details',
188188
'visibility',
189189
80
190190
);
191191
$categorySetup->addAttributeToGroup(
192-
ProductAttributeInterface::ENTITY_TYPE_CODE,
192+
\Magento\Catalog\Model\Product::ENTITY,
193193
$attributeSetId,
194194
'Product Details',
195195
'news_from_date',
196196
90
197197
);
198198
$categorySetup->addAttributeToGroup(
199-
ProductAttributeInterface::ENTITY_TYPE_CODE,
199+
\Magento\Catalog\Model\Product::ENTITY,
200200
$attributeSetId,
201201
'Product Details',
202202
'news_to_date',
203203
100
204204
);
205205
$categorySetup->addAttributeToGroup(
206-
ProductAttributeInterface::ENTITY_TYPE_CODE,
206+
\Magento\Catalog\Model\Product::ENTITY,
207207
$attributeSetId,
208208
'Product Details',
209209
'country_of_manufacture',
@@ -212,26 +212,26 @@ public function upgrade(ModuleDataSetupInterface $setup, ModuleContextInterface
212212

213213
//Content tab
214214
$categorySetup->addAttributeGroup(
215-
ProductAttributeInterface::ENTITY_TYPE_CODE,
215+
\Magento\Catalog\Model\Product::ENTITY,
216216
$attributeSetId,
217217
'Content',
218218
15
219219
);
220220
$categorySetup->updateAttributeGroup(
221-
ProductAttributeInterface::ENTITY_TYPE_CODE,
221+
\Magento\Catalog\Model\Product::ENTITY,
222222
$attributeSetId,
223223
'Content',
224224
'tab_group_code',
225225
'basic'
226226
);
227227
$categorySetup->addAttributeToGroup(
228-
ProductAttributeInterface::ENTITY_TYPE_CODE,
228+
\Magento\Catalog\Model\Product::ENTITY,
229229
$attributeSetId,
230230
'Content',
231231
'description'
232232
);
233233
$categorySetup->addAttributeToGroup(
234-
ProductAttributeInterface::ENTITY_TYPE_CODE,
234+
\Magento\Catalog\Model\Product::ENTITY,
235235
$attributeSetId,
236236
'Content',
237237
'short_description',
@@ -240,53 +240,53 @@ public function upgrade(ModuleDataSetupInterface $setup, ModuleContextInterface
240240

241241
//Images tab
242242
$groupId = (int)$categorySetup->getAttributeGroupByCode(
243-
ProductAttributeInterface::ENTITY_TYPE_CODE,
243+
\Magento\Catalog\Model\Product::ENTITY,
244244
$attributeSetId,
245245
'image-management',
246246
'attribute_group_id'
247247
);
248248
$categorySetup->addAttributeToGroup(
249-
ProductAttributeInterface::ENTITY_TYPE_CODE,
249+
\Magento\Catalog\Model\Product::ENTITY,
250250
$attributeSetId,
251251
$groupId,
252252
'image',
253253
1
254254
);
255255
$categorySetup->updateAttributeGroup(
256-
ProductAttributeInterface::ENTITY_TYPE_CODE,
256+
\Magento\Catalog\Model\Product::ENTITY,
257257
$attributeSetId,
258258
$groupId,
259259
'attribute_group_name',
260260
'Images'
261261
);
262262
$categorySetup->updateAttribute(
263-
ProductAttributeInterface::ENTITY_TYPE_CODE,
263+
\Magento\Catalog\Model\Product::ENTITY,
264264
'image',
265265
'frontend_label',
266266
'Base'
267267
);
268268
$categorySetup->updateAttribute(
269-
ProductAttributeInterface::ENTITY_TYPE_CODE,
269+
\Magento\Catalog\Model\Product::ENTITY,
270270
'small_image',
271271
'frontend_label',
272272
'Small'
273273
);
274274
$categorySetup->updateAttribute(
275-
ProductAttributeInterface::ENTITY_TYPE_CODE,
275+
\Magento\Catalog\Model\Product::ENTITY,
276276
'image',
277277
'frontend_input_renderer',
278278
null
279279
);
280280

281281
//Design tab
282282
$categorySetup->updateAttribute(
283-
ProductAttributeInterface::ENTITY_TYPE_CODE,
283+
\Magento\Catalog\Model\Product::ENTITY,
284284
'page_layout',
285285
'frontend_label',
286286
'Layout'
287287
);
288288
$categorySetup->updateAttribute(
289-
ProductAttributeInterface::ENTITY_TYPE_CODE,
289+
\Magento\Catalog\Model\Product::ENTITY,
290290
'custom_layout_update',
291291
'frontend_label',
292292
'Layout Update XML',
@@ -295,47 +295,47 @@ public function upgrade(ModuleDataSetupInterface $setup, ModuleContextInterface
295295

296296
//Schedule Design Update tab
297297
$categorySetup->addAttributeGroup(
298-
ProductAttributeInterface::ENTITY_TYPE_CODE,
298+
\Magento\Catalog\Model\Product::ENTITY,
299299
$attributeSetId,
300300
'Schedule Design Update',
301301
55
302302
);
303303
$categorySetup->updateAttributeGroup(
304-
ProductAttributeInterface::ENTITY_TYPE_CODE,
304+
\Magento\Catalog\Model\Product::ENTITY,
305305
$attributeSetId,
306306
'Schedule Design Update',
307307
'tab_group_code',
308308
'advanced'
309309
);
310310
$categorySetup->addAttributeToGroup(
311-
ProductAttributeInterface::ENTITY_TYPE_CODE,
311+
\Magento\Catalog\Model\Product::ENTITY,
312312
$attributeSetId,
313313
'Schedule Design Update',
314314
'custom_design_from',
315315
20
316316
);
317317
$categorySetup->addAttributeToGroup(
318-
ProductAttributeInterface::ENTITY_TYPE_CODE,
318+
\Magento\Catalog\Model\Product::ENTITY,
319319
$attributeSetId,
320320
'Schedule Design Update',
321321
'custom_design_to',
322322
30
323323
);
324324
$categorySetup->updateAttribute(
325-
ProductAttributeInterface::ENTITY_TYPE_CODE,
325+
\Magento\Catalog\Model\Product::ENTITY,
326326
'custom_design',
327327
'frontend_label',
328328
'New Theme',
329329
40
330330
);
331331
$categorySetup->addAttributeToGroup(
332-
ProductAttributeInterface::ENTITY_TYPE_CODE,
332+
\Magento\Catalog\Model\Product::ENTITY,
333333
$attributeSetId,
334334
'Schedule Design Update',
335335
'custom_design'
336336
);
337337
$categorySetup->addAttribute(
338-
ProductAttributeInterface::ENTITY_TYPE_CODE,
338+
\Magento\Catalog\Model\Product::ENTITY,
339339
'custom_layout',
340340
[
341341
'type' => 'varchar',
@@ -344,7 +344,7 @@ public function upgrade(ModuleDataSetupInterface $setup, ModuleContextInterface
344344
'source' => \Magento\Catalog\Model\Product\Attribute\Source\Layout::class,
345345
'required' => false,
346346
'sort_order' => 50,
347-
'global' => ScopedAttributeInterface::SCOPE_STORE,
347+
'global' => \Magento\Eav\Model\Entity\Attribute\ScopedAttributeInterface::SCOPE_STORE,
348348
'group' => 'Schedule Design Update',
349349
'is_used_in_grid' => true,
350350
'is_visible_in_grid' => false,
@@ -358,7 +358,7 @@ public function upgrade(ModuleDataSetupInterface $setup, ModuleContextInterface
358358
$eavSetup = $this->eavSetupFactory->create(['setup' => $setup]);
359359

360360
$eavSetup->updateAttribute(
361-
ProductAttributeInterface::ENTITY_TYPE_CODE,
361+
\Magento\Catalog\Model\Product::ENTITY,
362362
'meta_description',
363363
[
364364
'note' => 'Maximum 255 chars. Meta Description should optimally be between 150-160 characters'
@@ -367,7 +367,7 @@ public function upgrade(ModuleDataSetupInterface $setup, ModuleContextInterface
367367
}
368368

369369
if (version_compare($context->getVersion(), '2.1.3') < 0) {
370-
/** @var \Magento\Catalog\Setup\CategorySetup $categorySetup */
370+
/** @var CategorySetup $categorySetup */
371371
$categorySetup = $this->categorySetupFactory->create(['setup' => $setup]);
372372
$this->changePriceAttributeDefaultScope($categorySetup);
373373
}
@@ -386,7 +386,7 @@ public function upgrade(ModuleDataSetupInterface $setup, ModuleContextInterface
386386
* Set to 'No' 'Is Allowed Html on Store Front' option on product name attribute, because product name
387387
* is multi entity field (used in order, quote) and cannot be conditionally escaped in all places
388388
*
389-
* @param ModuleDataSetupInterface $categorySetup
389+
* @param ModuleDataSetupInterface $setup
390390
* @return void
391391
*/
392392
private function dissallowUsingHtmlForProductName(ModuleDataSetupInterface $setup)
@@ -405,7 +405,7 @@ private function dissallowUsingHtmlForProductName(ModuleDataSetupInterface $setu
405405
}
406406

407407
/**
408-
* @param \Magento\Catalog\Setup\CategorySetup $categorySetup
408+
* @param CategorySetup $categorySetup
409409
* @return void
410410
*/
411411
private function changePriceAttributeDefaultScope($categorySetup)

0 commit comments

Comments
 (0)