Magento Extensions Rating 2024
EXTENSIONS BY CATEGORY
B2B (Business-To-Business)
Blog
Customer
ERP (Enterprise Resource Planning)
Mega Menu
One Step Checkout
Order
POS (Point Of Sale)
Search
Shopping Cart
Sitemap
SEO
Social
Stock & Inventory Management
EXTENSIONS BY DEVELOPER
aheadWorks
Amasty
Boost My Shop
BSS Commerce
Magestore
MageWorx
Mirasvit
Templates Master
Wyomind
XTENTO
Magento 2 Documentation
Magento 2 Documentation
2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
vendor
magento
module-customer
Setup
Patch
Data
AddNonSpecifiedGenderAttributeOption.php
Go to the documentation of this file.
1
<?php
7
namespace
Magento\Customer\Setup\Patch\Data
;
8
9
use
Magento\Customer\Model\Customer
;
10
use Magento\Customer\Setup\CustomerSetupFactory;
11
use
Magento\Directory\Model\AllowedCountries
;
12
use
Magento\Framework\App\ObjectManager
;
13
use
Magento\Framework\Encryption\Encryptor
;
14
use
Magento\Framework\Indexer\IndexerRegistry
;
15
use
Magento\Framework\Setup\SetupInterface
;
16
use
Magento\Framework\Setup\UpgradeDataInterface
;
17
use
Magento\Framework\Setup\ModuleContextInterface
;
18
use
Magento\Framework\Setup\ModuleDataSetupInterface
;
19
use
Magento\Store\Model\ScopeInterface
;
20
use
Magento\Store\Model\StoreManagerInterface
;
21
use
Magento\Framework\DB\FieldDataConverterFactory
;
22
use
Magento\Framework\DB\DataConverter\SerializedToJson
;
23
use
Magento\Framework\App\ResourceConnection
;
24
use
Magento\Framework\Setup\Patch\DataPatchInterface
;
25
use
Magento\Framework\Setup\Patch\PatchVersionInterface
;
26
31
class
AddNonSpecifiedGenderAttributeOption
implements
DataPatchInterface
,
PatchVersionInterface
32
{
36
private
$moduleDataSetup;
37
41
private
$customerSetupFactory;
42
48
public
function
__construct
(
49
ModuleDataSetupInterface
$moduleDataSetup,
50
CustomerSetupFactory $customerSetupFactory
51
) {
52
$this->moduleDataSetup = $moduleDataSetup;
53
$this->customerSetupFactory = $customerSetupFactory;
54
}
55
59
public
function
apply
()
60
{
61
$customerSetup = $this->customerSetupFactory->create([
'setup'
=> $this->moduleDataSetup]);
62
$entityTypeId
= $customerSetup->getEntityTypeId(
Customer::ENTITY
);
63
$attributeId = $customerSetup->getAttributeId(
$entityTypeId
,
'gender'
);
64
65
$option
= [
'attribute_id'
=> $attributeId,
'values'
=> [3 =>
'Not Specified'
]];
66
$customerSetup->addAttributeOption(
$option
);
67
}
68
72
public
static
function
getDependencies
()
73
{
74
return
[
75
UpdateCustomerAttributesMetadata::class,
76
];
77
}
78
82
public
static
function
getVersion
()
83
{
84
return
'2.0.2'
;
85
}
86
90
public
function
getAliases
()
91
{
92
return
[];
93
}
94
}
$entityTypeId
$entityTypeId
Definition:
attribute_set_with_renamed_group.php:28
Magento\Framework\Encryption\Encryptor
Definition:
Encryptor.php:21
Magento\Customer\Setup\Patch\Data\AddNonSpecifiedGenderAttributeOption
Definition:
AddNonSpecifiedGenderAttributeOption.php:31
Magento\Framework\Setup\Patch\DataPatchInterface
Definition:
DataPatchInterface.php:12
Magento\Framework\DB\FieldDataConverterFactory
Definition:
FieldDataConverterFactory.php:13
Magento\Framework\DB\DataConverter\SerializedToJson
Definition:
SerializedToJson.php:14
Magento\Customer\Setup\Patch\Data\AddNonSpecifiedGenderAttributeOption\getAliases
getAliases()
Definition:
AddNonSpecifiedGenderAttributeOption.php:90
Magento\Framework\Setup\ModuleContextInterface
Definition:
ModuleContextInterface.php:13
Magento\Customer\Setup\Patch\Data\AddNonSpecifiedGenderAttributeOption\__construct
__construct(ModuleDataSetupInterface $moduleDataSetup, CustomerSetupFactory $customerSetupFactory)
Definition:
AddNonSpecifiedGenderAttributeOption.php:48
Magento\Framework\Setup\SetupInterface
Definition:
SetupInterface.php:14
Magento\Framework\App\ObjectManager
Definition:
ConfigCache.php:8
Magento\Framework\Setup\ModuleDataSetupInterface
Definition:
ModuleDataSetupInterface.php:14
Magento\Store\Model\StoreManagerInterface
Definition:
StoreManagerInterface.php:17
Magento\Store\Model\ScopeInterface
Definition:
ScopeInterface.php:12
Magento\Customer\Setup\Patch\Data
Definition:
AddCustomerUpdatedAtAttribute.php:7
Magento\Directory\Model\AllowedCountries
Definition:
AllowedCountries.php:19
Magento\Customer\Model\Customer\ENTITY
const ENTITY
Definition:
Customer.php:79
Magento\Framework\Setup\UpgradeDataInterface
Definition:
UpgradeDataInterface.php:14
Magento\Customer\Model\Customer
Magento\Framework\Setup\Patch\PatchVersionInterface
Definition:
PatchVersionInterface.php:13
Magento\Customer\Setup\Patch\Data\AddNonSpecifiedGenderAttributeOption\getVersion
static getVersion()
Definition:
AddNonSpecifiedGenderAttributeOption.php:82
Magento\Framework\Indexer\IndexerRegistry
Definition:
IndexerRegistry.php:12
Magento\Customer\Setup\Patch\Data\AddNonSpecifiedGenderAttributeOption\apply
apply()
Definition:
AddNonSpecifiedGenderAttributeOption.php:59
Magento\Customer\Setup\Patch\Data\AddNonSpecifiedGenderAttributeOption\getDependencies
static getDependencies()
Definition:
AddNonSpecifiedGenderAttributeOption.php:72
Magento\Framework\App\ResourceConnection
$option
$option
Definition:
product_configurable_with_single_child.php:38