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
magento2-base
dev
tests
integration
testsuite
Magento
Customer
_files
customer_address.php
Go to the documentation of this file.
1
<?php
8
$objectManager
=
\Magento\TestFramework\Helper\Bootstrap::getObjectManager
();
10
$customerAddress
=
$objectManager
->create(\
Magento
\Customer\Model\Address::class);
12
$customerRegistry
=
$objectManager
->get(\
Magento
\Customer\Model\CustomerRegistry::class);
13
$customerAddress
->isObjectNew(
true
);
14
$customerAddress
->setData(
15
[
16
'entity_id'
=> 1,
17
'attribute_set_id'
=> 2,
18
'telephone'
=> 3468676,
19
'postcode'
=> 75477,
20
'country_id'
=>
'US'
,
21
'city'
=>
'CityM'
,
22
'company'
=>
'CompanyName'
,
23
'street'
=>
'Green str, 67'
,
24
'lastname'
=>
'Smith'
,
25
'firstname'
=>
'John'
,
26
'parent_id'
=> 1,
27
'region_id'
=> 1,
28
]
29
);
30
$customerAddress
->save();
31
33
$addressRepository
=
$objectManager
->get(\
Magento
\Customer\Api\AddressRepositoryInterface::class);
34
$customerAddress
=
$addressRepository
->getById(1);
35
$customerAddress
->setCustomerId(1);
36
$customerAddress
=
$addressRepository
->save(
$customerAddress
);
37
$customerRegistry
->remove(
$customerAddress
->getCustomerId());
39
$addressRegistry
=
$objectManager
->get(\
Magento
\Customer\Model\AddressRegistry::class);
40
$addressRegistry
->remove(
$customerAddress
->getId());
$addressRepository
$addressRepository
Definition:
customer_address.php:33
$objectManager
$objectManager
Definition:
customer_address.php:8
$addressRegistry
$addressRegistry
Definition:
customer_address.php:39
$customerRegistry
$customerRegistry
Definition:
customer_address.php:12
Magento
$customerAddress
$customerAddress
Definition:
customer_address.php:10
Magento\TestFramework\Helper\Bootstrap\getObjectManager
static getObjectManager()
Definition:
Bootstrap.php:125