getnet-adquirencia /
split-example-magento
| 1 | <?php |
||
| 2 | /** |
||
| 3 | * Copyright © Getnet. All rights reserved. |
||
| 4 | * |
||
| 5 | * @author Bruno Elisei <[email protected]> |
||
| 6 | * See LICENSE for license details. |
||
| 7 | */ |
||
| 8 | |||
| 9 | namespace Getnet\SplitExampleMagento\Setup\Patch\Data; |
||
| 10 | |||
| 11 | use Magento\Eav\Setup\EavSetupFactory; |
||
|
0 ignored issues
–
show
|
|||
| 12 | use Magento\Framework\Setup\ModuleDataSetupInterface; |
||
| 13 | use Magento\Framework\Setup\Patch\DataPatchInterface; |
||
| 14 | |||
| 15 | /** |
||
| 16 | * Class Sub Seller Id - add attribute for product. |
||
| 17 | */ |
||
| 18 | class SubSellerId implements DataPatchInterface |
||
| 19 | { |
||
| 20 | /** |
||
| 21 | * @var ModuleDataSetupInterface |
||
| 22 | */ |
||
| 23 | protected $moduleDataSetup; |
||
| 24 | |||
| 25 | /** |
||
| 26 | * @var EavSetupFactory |
||
| 27 | */ |
||
| 28 | protected $eavSetupFactory; |
||
| 29 | |||
| 30 | /** |
||
| 31 | * @param ModuleDataSetupInterface $moduleDataSetup |
||
| 32 | * @param EavSetupFactory $eavSetupFactory |
||
| 33 | */ |
||
| 34 | public function __construct( |
||
| 35 | ModuleDataSetupInterface $moduleDataSetup, |
||
| 36 | EavSetupFactory $eavSetupFactory |
||
| 37 | ) { |
||
| 38 | $this->moduleDataSetup = $moduleDataSetup; |
||
| 39 | $this->eavSetupFactory = $eavSetupFactory; |
||
| 40 | } |
||
| 41 | |||
| 42 | /** |
||
| 43 | * @inheritdoc |
||
| 44 | * @SuppressWarnings(PHPMD.ExcessiveMethodLength) |
||
| 45 | */ |
||
| 46 | public function apply() |
||
| 47 | { |
||
| 48 | $eavSetup = $this->eavSetupFactory->create(['setup' => $this->moduleDataSetup]); |
||
| 49 | |||
| 50 | $productTypes = [ |
||
| 51 | \Magento\Catalog\Model\Product\Type::TYPE_SIMPLE, |
||
| 52 | \Magento\Catalog\Model\Product\Type::TYPE_VIRTUAL, |
||
| 53 | \Magento\Downloadable\Model\Product\Type::TYPE_DOWNLOADABLE, |
||
| 54 | \Magento\Catalog\Model\Product\Type::TYPE_BUNDLE, |
||
| 55 | \Magento\ConfigurableProduct\Model\Product\Type\Configurable::TYPE_CODE, |
||
|
0 ignored issues
–
show
The type
Magento\ConfigurableProd...oduct\Type\Configurable was not found. Maybe you did not declare it correctly or list all dependencies?
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. filter:
dependency_paths: ["lib/*"]
For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths Loading history...
|
|||
| 56 | ]; |
||
| 57 | $productTypes = join(',', $productTypes); |
||
| 58 | |||
| 59 | $eavSetup->addAttribute( |
||
| 60 | \Magento\Catalog\Model\Product::ENTITY, |
||
| 61 | 'getnet_sub_seller_id', |
||
| 62 | [ |
||
| 63 | 'type' => 'varchar', |
||
| 64 | 'backend' => '', |
||
| 65 | 'frontend' => '', |
||
| 66 | 'label' => 'Getnet Sub Seller', |
||
| 67 | 'input' => 'hidden', |
||
| 68 | 'class' => '', |
||
| 69 | 'source' => '', |
||
| 70 | 'global' => \Magento\Eav\Model\Entity\Attribute\ScopedAttributeInterface::SCOPE_GLOBAL, |
||
| 71 | 'visible' => true, |
||
| 72 | 'required' => false, |
||
| 73 | 'user_defined' => true, |
||
| 74 | 'default' => '', |
||
| 75 | 'searchable' => false, |
||
| 76 | 'filterable' => false, |
||
| 77 | 'comparable' => false, |
||
| 78 | 'visible_on_front' => false, |
||
| 79 | 'used_in_product_listing' => true, |
||
| 80 | 'unique' => false, |
||
| 81 | 'apply_to' => $productTypes, |
||
| 82 | ] |
||
| 83 | ); |
||
| 84 | |||
| 85 | $entityTypeId = $eavSetup->getEntityTypeId(\Magento\Catalog\Model\Product::ENTITY); |
||
| 86 | $attributeSetIds = $eavSetup->getAllAttributeSetIds($entityTypeId); |
||
| 87 | foreach ($attributeSetIds as $attributeSetId) { |
||
| 88 | $groupId = $eavSetup->getAttributeGroupId($entityTypeId, $attributeSetId, 'General'); |
||
| 89 | $eavSetup->addAttributeToGroup( |
||
| 90 | $entityTypeId, |
||
| 91 | $attributeSetId, |
||
| 92 | $groupId, |
||
| 93 | 'getnet_sub_seller_id', |
||
| 94 | null |
||
| 95 | ); |
||
| 96 | } |
||
| 97 | } |
||
| 98 | |||
| 99 | /** |
||
| 100 | * @inheritdoc |
||
| 101 | */ |
||
| 102 | public static function getDependencies() |
||
| 103 | { |
||
| 104 | return []; |
||
| 105 | } |
||
| 106 | |||
| 107 | /** |
||
| 108 | * @inheritdoc |
||
| 109 | */ |
||
| 110 | public static function getVersion() |
||
| 111 | { |
||
| 112 | return '100.0.1'; |
||
| 113 | } |
||
| 114 | |||
| 115 | /** |
||
| 116 | * @inheritdoc |
||
| 117 | */ |
||
| 118 | public function getAliases() |
||
| 119 | { |
||
| 120 | return []; |
||
| 121 | } |
||
| 122 | } |
||
| 123 |
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