Using Magento-2.1.3 CE
For a purpose,have created a Customer attribute which are using at time of Customer Registration and customer edit page
in frontend.
On the edit page,i got the error when i was trying to fetch data of that attribute. and i have post the issue at MSE Custom customer attribute are throwing error at Customer edit Page - Magento2
And got the answer from Khoa TruongDinh . Khoa TruongDinh was suggest me to use
$block->getCustomer()->getCustomAttribute('[Custom_Attribute]]')
Or
$block->getCustomer()->getExtensionAttributes()->get[Custom_Attribute]();
At last of using $block->getCustomer()->getCustomAttribute([Custom_Attribute]]');
i get this attribute value at edit.phtml
Now question is:
- Why we need to use
$block->getCustomer()->getCustomAttribute('[Custom_Attribute]]')
and$block->getCustomer()->getExtensionAttributes()->get[Custom_Attribute]();
for getting the value of this custom attribute - What are different between
$block->getCustomer()->getExtensionAttributes()->get[Custom_Attribute]();
and$block->getCustomer()->getExtensionAttributes()->get[Custom_Attribute]();
- Why magento use
Magento\Customer\Model\Data\Customer
for customer edit and register page?
Can anyone of magento SE give the answer of above questions?