Created
January 13, 2015 13:56
-
-
Save amacgregor/497d247b9d34b47e487a to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Retrieve Customer instance | |
* | |
* @return \Magento\Customer\Api\Data\CustomerInterface | |
*/ | |
public function getCustomer() | |
{ | |
if (is_null($this->_customer)) { | |
$params = $this->urlDecoder->decode($this->_getRequest()->getParam('data')); | |
$data = explode(',', $params); | |
$customerId = abs(intval($data[0])); | |
if ($customerId && ($customerId == $this->_customerSession->getCustomerId())) { | |
$this->_customer = $this->_customerRepository->getById($customerId); | |
} else { | |
$this->_customer = $this->_customerBuilder->create(); | |
} | |
} | |
return $this->_customer; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment