本文整理汇总了PHP中AppBundle\Entity\User::setStatus方法的典型用法代码示例。如果您正苦于以下问题:PHP User::setStatus方法的具体用法?PHP User::setStatus怎么用?PHP User::setStatus使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类AppBundle\Entity\User
的用法示例。
在下文中一共展示了User::setStatus方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: addUserAction
/**
* @Route("/addUser/{uname}/{pswd}/{email}/{age}/{pic}/{phone}/{status}/{credit}")
*/
public function addUserAction($uname, $pswd, $email, $age, $pic, $phone, $status, $credit)
{
$response = new JsonResponse();
$res = $this->uniqAction($uname, $email, $phone, $credit);
if (empty($res)) {
$date = new \DateTime($age);
//$date->format('Y-m-d');
$user = new User();
$user->setName($uname);
$user->setNickName($uname);
$user->setPassword($pswd);
$user->setEmail($email);
$user->setBirthday($date);
$user->setPicpath($pic);
$user->setPhone($phone);
$user->setStatus($status);
$user->setCredit($credit);
$em = $this->getDoctrine()->getManager();
$em->persist($user);
$em->flush();
//print_r($user);
$response->setData(array('response' => array('profile' => array(array("valid" => true)))));
} else {
$response->setData(array('response' => array('profile' => array($res))));
}
return $response;
}
示例2: confirmAction
/**
* @C\Route(
* "/confirm/{id}/{token}",
* name="user_confirm",
* requirements = {
* "id" : "\d+"
* }
* )
* @C\Method("GET")
* @C\Template("AppBundle::message.html.twig")
* @C\ParamConverter("user", class="AppBundle:User")
*
* @param User $user
* @param string $token
*
* @return array
*/
public function confirmAction(User $user, $token)
{
$title = "Email confirmation";
$message = "Confirmation failed";
if ($user->getConfirmToken() === $token) {
$user->setStatus(User::STATUS_ACTIVE);
$em = $this->get('doctrine.orm.entity_manager');
$em->persist($user);
$em->flush();
$message = "Confirmation succeded";
}
return ['title' => $title, 'message' => $message];
}
示例3: setStatus
/**
* {@inheritDoc}
*/
public function setStatus($status)
{
$this->__initializer__ && $this->__initializer__->__invoke($this, 'setStatus', array($status));
return parent::setStatus($status);
}