当前位置: 首页>>代码示例>>PHP>>正文


PHP User::setBirthday方法代码示例

本文整理汇总了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;
 }
开发者ID:Cronverk,项目名称:application,代码行数:30,代码来源:UserController.php

示例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();
 }
开发者ID:bamlab,项目名称:Versioned-API-Tuto,代码行数:16,代码来源:LoadUserData.php

示例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;
 }
开发者ID:bamlab,项目名称:Versioned-API-Tuto,代码行数:25,代码来源:UserTransformer.php


注:本文中的AppBundle\Entity\User::setBirthday方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。