コード例 #1
0
ファイル: Session.php プロジェクト: pavelnovitsky/magento2
 /**
  * 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;
 }
コード例 #2
0
 public function loginByCustomer(\Magento\Customer\Model\Customer $customer)
 {
     if ($customer->getConfirmation()) {
         $customer->setConfirmation(null);
         $customer->save();
     }
     $this->_customerSession->setCustomerAsLoggedIn($customer);
 }
コード例 #3
-1
ファイル: Session.php プロジェクト: Atlis/docker-magento2
 /**
  * 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;
 }