diff --git a/src/Controller/CustomerAppAPI/AuthController.php b/src/Controller/CustomerAppAPI/AuthController.php index 973c80de..128de8a8 100644 --- a/src/Controller/CustomerAppAPI/AuthController.php +++ b/src/Controller/CustomerAppAPI/AuthController.php @@ -173,6 +173,8 @@ class AuthController extends ApiController } if (!$customer_user) { + error_log("We don't have a customer user for session " . $this->session->getID()); + $customer_user = $this->findCustomerUserByNumber($this->session->getPhoneNumber()); if ($customer_user === null) { @@ -183,15 +185,17 @@ class AuthController extends ApiController // save $this->em->persist($customer_user); + $this->em->flush(); } else { 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 $this->session->setCustomerUser($customer_user); + $this->em->flush(); // response return new ApiResponse(true, '', [