本文整理汇总了PHP中App\Model\User::setPassword方法的典型用法代码示例。如果您正苦于以下问题:PHP User::setPassword方法的具体用法?PHP User::setPassword怎么用?PHP User::setPassword使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类App\Model\User
的用法示例。
在下文中一共展示了User::setPassword方法的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: setValueFromRequest
private function setValueFromRequest(User $user, Request $request)
{
if (!empty($request->get('email'))) {
$user->setEmail($request->get('email'));
}
if (!empty($request->get('password'))) {
$user->setPassword($this->hasher->hashPassword($request->get('password')));
}
if (!empty($request->get('role'))) {
$user->setRole($request->get('role'));
}
}
示例3: insertUser
private function insertUser(Request $request)
{
$email = $request->get('email');
$password = $request->get('password');
$user = new User();
$user->setEmail($email);
$user->setPassword($this->hasher->hashPassword($password));
$this->em->persist($user);
$this->em->flush();
}