Fix customer user not being properly associated with session #730
This commit is contained in:
parent
c4878a9e6d
commit
31c0f4a102
1 changed files with 5 additions and 1 deletions
|
|
@ -173,6 +173,8 @@ class AuthController extends ApiController
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!$customer_user) {
|
if (!$customer_user) {
|
||||||
|
error_log("We don't have a customer user for session " . $this->session->getID());
|
||||||
|
|
||||||
$customer_user = $this->findCustomerUserByNumber($this->session->getPhoneNumber());
|
$customer_user = $this->findCustomerUserByNumber($this->session->getPhoneNumber());
|
||||||
|
|
||||||
if ($customer_user === null) {
|
if ($customer_user === null) {
|
||||||
|
|
@ -183,15 +185,17 @@ class AuthController extends ApiController
|
||||||
|
|
||||||
// save
|
// save
|
||||||
$this->em->persist($customer_user);
|
$this->em->persist($customer_user);
|
||||||
|
$this->em->flush();
|
||||||
} else {
|
} else {
|
||||||
error_log("Found existing customer user for " . $this->session->getPhoneNumber());
|
error_log("Found existing customer user for " . $this->session->getPhoneNumber());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->em->flush();
|
error_log("Customer user ID is " . $customer_user->getID());
|
||||||
|
|
||||||
// set session customer user
|
// set session customer user
|
||||||
$this->session->setCustomerUser($customer_user);
|
$this->session->setCustomerUser($customer_user);
|
||||||
|
$this->em->flush();
|
||||||
|
|
||||||
// response
|
// response
|
||||||
return new ApiResponse(true, '', [
|
return new ApiResponse(true, '', [
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue