Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
attribute_user_defined_address.php
Go to the documentation of this file.
1 <?php
7 $model = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create(\Magento\Customer\Model\Attribute::class);
8 $model->setName(
9  'address_user_attribute'
10 )->setEntityTypeId(
11  2
12 )->setAttributeSetId(
13  2
14 )->setAttributeGroupId(
15  1
16 )->setFrontendInput(
17  'text'
18 )->setFrontendLabel(
19  'Address user attribute'
20 )->setIsUserDefined(
21  1
22 );
23 $model->save();
24 
27  \Magento\Customer\Setup\CustomerSetup::class
28 );
29 $data = [['form_code' => 'customer_address_edit', 'attribute_id' => $model->getAttributeId()]];
30 $setupResource->getSetup()->getConnection()->insertMultiple(
31  $setupResource->getSetup()->getTable('customer_form_attribute'),
32  $data
33 );