10 use Magento\Customer\Api\Data\AddressInterfaceFactory;
11 use Magento\Customer\Api\Data\RegionInterfaceFactory;
23 class Address extends \Magento\Customer\Model\Address\AbstractAddress
55 private $attributeList;
83 \
Magento\Framework\Api\ExtensionAttributesFactory $extensionFactory,
85 \
Magento\Directory\Helper\Data $directoryData,
88 \
Magento\Directory\Model\RegionFactory $regionFactory,
89 \
Magento\Directory\Model\CountryFactory $countryFactory,
98 \
Magento\Framework\Data\Collection\AbstractDb $resourceCollection =
null,
147 $this->setRegion(
$address->getRegion()->getRegion());
148 $this->setRegionCode(
$address->getRegion()->getRegionCode());
155 $this->setIsDefaultBilling(
$address->isDefaultBilling());
156 $this->setIsDefaultShipping(
$address->isDefaultShipping());
160 $customAttributes =
$address->getCustomAttributes();
161 if ($customAttributes !==
null) {
173 public function getDataModel($defaultBillingAddressId =
null, $defaultShippingAddressId =
null)
176 if ($this->
getCustomer()->getDefaultBillingAddress()) {
177 $defaultBillingAddressId = $this->
getCustomer()->getDefaultBillingAddress()->getId();
179 if ($this->
getCustomer()->getDefaultShippingAddress()) {
180 $defaultShippingAddressId = $this->
getCustomer()->getDefaultShippingAddress()->getId();
183 return parent::getDataModel($defaultBillingAddressId, $defaultShippingAddressId);
193 return $this->
_getData(
'customer_id') ? $this->
_getData(
'customer_id') : $this->getParentId();
204 $this->setParentId(
$id);
219 if (empty($this->_customer)) {
288 return (
int)$this->
getData(
'region_id');
299 $this->
setData(
'region_id', (
int)$regionId);
308 return $this->_customerFactory->create();
330 $this->
_getResource()->addCommitCallback([$this,
'reindex']);
332 return parent::afterSave();
343 return parent::afterDeleteCommit();
351 public function reindex()
364 return array_keys($this->getAttributeList()->
getAttributes());
372 private function getAttributeList()
374 if (!$this->attributeList) {
379 return $this->attributeList;
getDefaultAttributeCodes()
__construct(\Magento\Framework\Model\Context $context, \Magento\Framework\Registry $registry, \Magento\Framework\Api\ExtensionAttributesFactory $extensionFactory, \Magento\Framework\Api\AttributeValueFactory $customAttributeFactory, \Magento\Directory\Helper\Data $directoryData, \Magento\Eav\Model\Config $eavConfig, \Magento\Customer\Model\Address\Config $addressConfig, \Magento\Directory\Model\RegionFactory $regionFactory, \Magento\Directory\Model\CountryFactory $countryFactory, AddressMetadataInterface $metadataService, AddressInterfaceFactory $addressDataFactory, RegionInterfaceFactory $regionDataFactory, \Magento\Framework\Api\DataObjectHelper $dataObjectHelper, CustomerFactory $customerFactory, \Magento\Framework\Reflection\DataObjectProcessor $dataProcessor, \Magento\Framework\Indexer\IndexerRegistry $indexerRegistry, \Magento\Framework\Model\ResourceModel\AbstractResource $resource=null, \Magento\Framework\Data\Collection\AbstractDb $resourceCollection=null, array $data=[])
updateData(AddressInterface $address)
getDataModel($defaultBillingAddressId=null, $defaultShippingAddressId=null)
getData($key='', $index=null)
const CUSTOMER_GRID_INDEXER_ID
getCustomAttributesCodes()
setDataUsingMethod($key, $args=[])
setData($key, $value=null)
setCustomer(Customer $customer)