|
| 1 | +<?php |
| 2 | +/** |
| 3 | + * Copyright © Magento, Inc. All rights reserved. |
| 4 | + * See COPYING.txt for license details. |
| 5 | + */ |
| 6 | + |
| 7 | +namespace Magento\Catalog\Setup\Patch\Data; |
| 8 | + |
| 9 | +use Magento\Catalog\Setup\CategorySetup; |
| 10 | +use Magento\Catalog\Setup\CategorySetupFactory; |
| 11 | +use Magento\Framework\App\ResourceConnection; |
| 12 | +use Magento\Framework\Setup\ModuleDataSetupInterface; |
| 13 | +use Magento\Framework\Setup\Patch\DataPatchInterface; |
| 14 | +use Magento\Framework\Setup\Patch\PatchVersionInterface; |
| 15 | + |
| 16 | +/** |
| 17 | + * Class UpdateProductDescriptionOrder |
| 18 | + * |
| 19 | + * @package Magento\Catalog\Setup\Patch |
| 20 | + */ |
| 21 | +class UpdateProductDescriptionOrder implements DataPatchInterface, PatchVersionInterface |
| 22 | +{ |
| 23 | + /** |
| 24 | + * @var ModuleDataSetupInterface |
| 25 | + */ |
| 26 | + private $moduleDataSetup; |
| 27 | + |
| 28 | + /** |
| 29 | + * @var CategorySetupFactory |
| 30 | + */ |
| 31 | + private $categorySetupFactory; |
| 32 | + |
| 33 | + /** |
| 34 | + * @param ModuleDataSetupInterface $moduleDataSetup |
| 35 | + * @param CategorySetupFactory $categorySetupFactory |
| 36 | + */ |
| 37 | + public function __construct( |
| 38 | + ModuleDataSetupInterface $moduleDataSetup, |
| 39 | + CategorySetupFactory $categorySetupFactory |
| 40 | + ) { |
| 41 | + $this->moduleDataSetup = $moduleDataSetup; |
| 42 | + $this->categorySetupFactory = $categorySetupFactory; |
| 43 | + } |
| 44 | + |
| 45 | + /** |
| 46 | + * {@inheritdoc} |
| 47 | + */ |
| 48 | + public function apply() |
| 49 | + { |
| 50 | + /** @var CategorySetup $categorySetup */ |
| 51 | + $categorySetup = $this->categorySetupFactory->create(['setup' => $this->moduleDataSetup]); |
| 52 | + $attributeSetId = $categorySetup->getDefaultAttributeSetId(\Magento\Catalog\Model\Product::ENTITY); |
| 53 | + |
| 54 | + // Content |
| 55 | + $categorySetup->addAttributeGroup( |
| 56 | + \Magento\Catalog\Model\Product::ENTITY, |
| 57 | + $attributeSetId, |
| 58 | + 'Content', |
| 59 | + 15 |
| 60 | + ); |
| 61 | + $categorySetup->updateAttributeGroup( |
| 62 | + \Magento\Catalog\Model\Product::ENTITY, |
| 63 | + $attributeSetId, |
| 64 | + 'Content', |
| 65 | + 'tab_group_code', |
| 66 | + 'basic' |
| 67 | + ); |
| 68 | + $categorySetup->addAttributeToGroup( |
| 69 | + \Magento\Catalog\Model\Product::ENTITY, |
| 70 | + $attributeSetId, |
| 71 | + 'Content', |
| 72 | + 'short_description', |
| 73 | + 100 |
| 74 | + ); |
| 75 | + $categorySetup->addAttributeToGroup( |
| 76 | + \Magento\Catalog\Model\Product::ENTITY, |
| 77 | + $attributeSetId, |
| 78 | + 'Content', |
| 79 | + 'description', |
| 80 | + 110 |
| 81 | + ); |
| 82 | + } |
| 83 | + |
| 84 | + /** |
| 85 | + * {@inheritdoc} |
| 86 | + */ |
| 87 | + public static function getDependencies() |
| 88 | + { |
| 89 | + return [ |
| 90 | + UpdateMediaAttributesBackendTypes::class, |
| 91 | + ]; |
| 92 | + } |
| 93 | + |
| 94 | + /** |
| 95 | + * {@inheritdoc} |
| 96 | + */ |
| 97 | + public static function getVersion() |
| 98 | + { |
| 99 | + return '2.3.5'; |
| 100 | + } |
| 101 | + |
| 102 | + /** |
| 103 | + * {@inheritdoc} |
| 104 | + */ |
| 105 | + public function getAliases() |
| 106 | + { |
| 107 | + return []; |
| 108 | + } |
| 109 | +} |
0 commit comments