Your IP : 127.0.0.1
<?php
/**
* Mirasvit
*
* This source file is subject to the Mirasvit Software License, which is available at https://mirasvit.com/license/.
* Do not edit or add to this file if you wish to upgrade the to newer versions in the future.
* If you wish to customize this module for your needs.
* Please refer to http://www.magentocommerce.com for more information.
*
* @category Mirasvit
* @package mirasvit/module-search-ultimate
* @version 2.3.2
* @copyright Copyright (C) 2024 Mirasvit (https://mirasvit.com/)
*/
namespace Mirasvit\Search\Setup\Patch\Data;
use Magento\Catalog\Api\Data\ProductAttributeInterface;
use Magento\Eav\Model\Entity\Attribute\ScopedAttributeInterface;
use Magento\Framework\Setup\ModuleDataSetupInterface;
use Magento\Framework\Setup\Patch\DataPatchInterface;
use Magento\Framework\Setup\Patch\PatchVersionInterface;
use Magento\Eav\Setup\EavSetupFactory;
class DataPatch103 implements DataPatchInterface, PatchVersionInterface
{
private $setup;
private $eavSetupFactory;
public function __construct(
ModuleDataSetupInterface $setup,
EavSetupFactory $eavSetupFactory
) {
$this->setup = $setup;
$this->eavSetupFactory = $eavSetupFactory;
}
/**
* {@inheritdoc}
*/
public static function getDependencies(): array
{
return [DataPatch101::class];
}
/**
* {@inheritdoc}
*/
public static function getVersion(): string
{
return '1.0.3';
}
/**
* {@inheritdoc}
*/
public function getAliases(): array
{
return [];
}
/**
* {@inheritdoc}
*/
public function apply()
{
$this->setup->startSetup();
$setup = $this->setup;
/** @var \Magento\Eav\Setup\EavSetup $eavSetup */
$eavSetup = $this->eavSetupFactory->create(['setup' => $setup]);
$eavSetup->addAttribute(
ProductAttributeInterface::ENTITY_TYPE_CODE,
'search_weight',
[
'type' => 'static',
'label' => 'Search Weight',
'input' => 'text',
'required' => false,
'sort_order' => 1000,
'global' => ScopedAttributeInterface::SCOPE_GLOBAL,
'group' => 'Product Details',
'is_used_in_grid' => false,
'is_visible_in_grid' => false,
'is_filterable_in_grid' => false,
]
);
$this->setup->endSetup();
}
}