本文整理匯總了PHP中App\Model\User::setUsername方法的典型用法代碼示例。如果您正苦於以下問題:PHP User::setUsername方法的具體用法?PHP User::setUsername怎麽用?PHP User::setUsername使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類App\Model\User
的用法示例。
在下文中一共展示了User::setUsername方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: signupUser
/**
* @param Request $request
* @param Response $response
*/
public function signupUser(Request $request, Response $response)
{
$username = $request->getParam('username');
$password = $request->getParam('password');
$email = $request->getParam('email');
$u = $this->em->getRepository('App\\Model\\User')->findOneBy(array('username' => $username));
if ($u != []) {
echo "Username nay da ton tai";
} else {
$user = new User();
$user->setUsername($username);
$user->setPassword($password);
$user->setEmail($email);
$this->em->persist($user);
$this->em->flush();
echo "Da them thanh vien moi thanh cong";
}
}
示例2: array
}
if ($nation == '' || $nation == null) {
$app->response->headers->set('Content-Type', 'application/json');
echo Util::resPonseJson($app, 4000, "nation cannot be null", array());
exit;
}
// $existeSystemId = $em->createQuery('SELECT u FROM App\Model\User u WHERE u.system_id = '.$systemId);
$existSystemId = $em->getRepository('App\\Model\\User')->findOneBy(array('system_id' => $systemId));
if ($existSystemId) {
$app->response->headers->set('Content-Type', 'application/json');
echo Util::resPonseJson($app, 4001, "User has existed", array());
exit;
}
$user = new User();
$user->setSystem_id($systemId);
$user->setUsername($username);
$user->setPassword_hash(password_hash($password, PASSWORD_BCRYPT));
$user->setBirthday(strtotime($birthday));
$user->setHome_town($home_town);
$user->setId_number($id_number);
$user->setNation($nation);
$user->setPhone($phone);
$user->setInviter($inviter);
$user->setSex($sex);
$user->setStatus(1);
$user->setCreated_at(time());
$user->setUpdated_at(time());
$user->setPayment_password("");
try {
$em->persist($user);
$em->flush();
示例3: createUser
/**
* @param string $accessToken
*
* @return User
*/
public function createUser($accessToken)
{
$data = $this->getUserData($accessToken);
$user = new User();
$user->setLoginProviderUserId($data['id']);
$user->setLoginProviderName($this->getName());
$user->setUsername($data['login']);
if (isset($data['email']) && strlen($data['email']) > 0) {
$user->setEmail($data['email']);
}
return $user;
}