if($success) { //prep the data for saving in a new user object $userData['emailId'] = $emailId; $userData['mobileNo'] = $mobileNo; $userData["lastName"] = $lastName; $userData["firstName"] = $firstName; $userData["middleName"] = $middleName; $userData["isActive"] = 0; //For the first time the user is not approved by admins $userData["isAdmin"] = 0; $userData["createdDate"] = date("Y-m-d H:i:s"); //prepare account related information to save in account object $accountData["userId"] = $emailId; $accountData["balance"] = INITIAL_BALANCE; $accountData["accountNo"] = Generators::generateUniqueAccountNo(); $accountData['password'] = $password; $accountData['securitytype'] = $securityType; //create the new user object $newUser = new User($userData); //create the new account object for this user $newAccount = new Account($accountData); //save the new user to the database $newUser->save(true); //save the account details to the database $newAccount->save(true);