/** * Retrieve customer model object * * @return \Magento\Customer\Model\Customer */ public function getCustomer() { /** * @TODO: Remove the method after all external usages are refactored in MAGETWO-19930 * _customer and _customerFactory variables should be eliminated as well */ if (null === $this->_customer) { $this->_customer = $this->_customerFactory->create(); $customerId = $this->getCustomerId(); if ($customerId) { $this->_customer->load($customerId); if (!$this->_customer->getId()) { $this->_customer->setCustomerId(null); } } } return $this->_customer; }