Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
attribute_user_defined_customer.php
Go to the documentation of this file.
1 <?php
7 if (!defined('FIXTURE_ATTRIBUTE_USER_DEFINED_CUSTOMER_NAME')) {
8  define('FIXTURE_ATTRIBUTE_USER_DEFINED_CUSTOMER_NAME', 'user_attribute');
9  define('FIXTURE_ATTRIBUTE_USER_DEFINED_CUSTOMER_FRONTEND_LABEL', 'frontend_label');
10 }
11 
13 $model = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create(\Magento\Customer\Model\Attribute::class);
14 
15 $model->setName(
16  FIXTURE_ATTRIBUTE_USER_DEFINED_CUSTOMER_NAME
17 )->setEntityTypeId(
18  1
19 )->setIsUserDefined(
20  1
21 )->setAttributeSetId(
22  1
23 )->setAttributeGroupId(
24  1
25 )->setFrontendInput(
26  'text'
27 )->setFrontendLabel(
28  FIXTURE_ATTRIBUTE_USER_DEFINED_CUSTOMER_FRONTEND_LABEL
29 )->setSortOrder(
30  1221
31 );
32 
33 $model->save();