本文整理匯總了PHP中AppBundle\Entity\User::setBirthday方法的典型用法代碼示例。如果您正苦於以下問題:PHP User::setBirthday方法的具體用法?PHP User::setBirthday怎麽用?PHP User::setBirthday使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類AppBundle\Entity\User
的用法示例。
在下文中一共展示了User::setBirthday方法的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: load
/**
* {@inheritDoc}
*/
public function load(ObjectManager $manager)
{
$userData = array(array('username' => 'johnDoe', 'email' => 'johndoe@fake.com', 'birthday' => new \DateTime('-25 years'), 'firstName' => 'John'), array('username' => 'brucewaine', 'email' => 'batman@fake.com', 'birthday' => new \DateTime('-30 years'), 'firstName' => 'Bruce'));
foreach ($userData as $data) {
$user = new User();
$user->setUsername($data['username']);
$user->setEmail($data['email']);
$user->setBirthday($data['birthday']);
$user->setFirstName($data['firstName']);
$manager->persist($user);
}
$manager->flush();
}
示例3: reverseTransform
/**
* Get back an user form its representation.
*
* @param UserRepresentation|null $representation
*
* @return User|null
*/
public function reverseTransform($representation)
{
if (!$representation) {
return;
}
if ($representation->getId()) {
$user = $this->userRepository->find($representation->getId());
if (!$user) {
throw new TransformationFailedException('User with the representation id not found');
}
} else {
$user = new User();
}
$user->setEmail($representation->getEmail());
$user->setUsername($representation->getUsername());
$user->setBirthday($representation->getBirthday());
return $user;
}