/** * Set customer model and the customer id in session * * @param Customer $customerModel * @return $this * @deprecated use setCustomerId() instead */ public function setCustomer(Customer $customerModel) { $this->_customerModel = $customerModel; $this->_httpContext->setValue(\Magento\Customer\Helper\Data::CONTEXT_GROUP, $customerModel->getGroupId(), \Magento\Customer\Model\Group::NOT_LOGGED_IN_ID); $this->setCustomerId($customerModel->getId()); if (!$customerModel->isConfirmationRequired() && $customerModel->getConfirmation()) { $customerModel->setConfirmation(null)->save(); } /** * The next line is a workaround. * It is used to distinguish users that are logged in from user data set via methods similar to setCustomerId() */ $this->unsIsCustomerEmulated(); return $this; }
/** * Set customer model and the customer id in session * * @param Customer $customerModel * @return $this * @deprecated use setCustomerId() instead */ public function setCustomer(Customer $customerModel) { $this->_customerModel = $customerModel; $this->_httpContext->setValue(\Magento\Customer\Helper\Data::CONTEXT_GROUP, $customerModel->getGroupId(), \Magento\Customer\Model\Group::NOT_LOGGED_IN_ID); $this->setCustomerId($customerModel->getId()); if (!$customerModel->isConfirmationRequired() && $customerModel->getConfirmation()) { $customerModel->setConfirmation(null)->save(); } return $this; }