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


PHP User::setFirstName方法代码示例

本文整理汇总了PHP中AppBundle\Entity\User::setFirstName方法的典型用法代码示例。如果您正苦于以下问题:PHP User::setFirstName方法的具体用法?PHP User::setFirstName怎么用?PHP User::setFirstName使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在AppBundle\Entity\User的用法示例。


在下文中一共展示了User::setFirstName方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: load

 /**
  * {@inheritDoc}
  */
 public function load(ObjectManager $manager)
 {
     $userAdmin = new User();
     $userAdmin->setUsername('ricardo75');
     $userAdmin->setFirstName('richard');
     $userAdmin->setLastName('lawson');
     $userAdmin->setEmail('richard@network90.com');
     $userAdmin->setPlainPassword('aberdeen');
     $userAdmin->setRoles(array('ROLE_SUPER_ADMIN'));
     $userAdmin->setEnabled(true);
     $user = new User();
     $user->setUsername('flipshark');
     $user->setFirstName('mick');
     $user->setLastName('jagger');
     $user->setEmail('lawson_richard@hotmail.com');
     $user->setPlainPassword('aberdeen');
     $user->setRoles(array('ROLE_USER'));
     $user->setEnabled(true);
     $user2 = new User();
     $user2->setUsername('elcondor');
     $user2->setFirstName('keith');
     $user2->setLastName('richards');
     $user2->setEmail('richard@hotmail.com');
     $user2->setPlainPassword('aberdeen');
     $user2->setRoles(array('ROLE_USER'));
     $user2->setEnabled(true);
     $manager->persist($userAdmin);
     $manager->persist($user);
     $manager->persist($user2);
     $manager->flush();
     $this->addReference('user-ricardo75', $userAdmin);
     $this->addReference('user-flipshark', $user);
 }
开发者ID:richardlawson,项目名称:coinflip,代码行数:36,代码来源:LoadUserData.php

示例2: injectUser

 protected function injectUser()
 {
     $this->user = new User();
     //$admin = 'tester'; // MWAHAHAHA
     //$departmentId = 5; // UiB
     $role = $this->em->getRepository('AppBundle:Role')->findOneByRole('ROLE_USER');
     $this->user->addRole($role);
     $this->user->setGender(1);
     $this->user->setFirstName("Shi");
     $this->user->setLastName("LaLong");
     $emd = $this->em->getRepository('AppBundle:FieldOfStudy')->find(40);
     // Tuple "Andre" from UiB, id 40 for fos
     $this->user->setFieldOfStudy($emd);
     $this->user->setUserName("shiluib");
     // Weird typo?
     $this->user->setEmail("shiluib@student.uib.no");
     $this->user->setPhone("47661674");
     $this->user->setPicturePath("images/defaultProfile.png");
     $this->user->setPassword("pimwrneil");
     $createNewUserCode = bin2hex(openssl_random_pseudo_bytes(16));
     $hashedNewUserCode = hash('sha512', $createNewUserCode, false);
     $this->user->setNewUserCode($hashedNewUserCode);
     // Persist the user
     $this->user->setIsActive(1);
     $this->em->persist($this->user);
     $this->em->flush();
     return $this;
 }
开发者ID:vegardbb,项目名称:webpage,代码行数:28,代码来源:UserRepositoryFunctionalTest.php

示例3: loginAction

 /**
  * @Route("/admin-login", name="admin-login")
  * @Template()
  */
 public function loginAction()
 {
     // создание пользователя
     $manager = $this->getDoctrine()->getManager();
     $user = new User();
     $user->setUsername('admin');
     $user->setSalt(md5(time()));
     $encoder = new MessageDigestPasswordEncoder('sha512', true, 10);
     $password = $encoder->encodePassword('admin', $user->getSalt());
     $user->setPassword($password);
     $user->setRoles('ROLE_OPERATOR');
     $user->setLastName('admin');
     $user->setFirstName('admin');
     $user->setSurName('admin');
     $user->setPhone('+79161111111');
     //
     $manager->persist($user);
     $manager->flush($user);
     if ($this->get('request')->attributes->has(SecurityContext::AUTHENTICATION_ERROR)) {
         $error = $this->get('request')->attributes->get(SecurityContext::AUTHENTICATION_ERROR);
     } else {
         $error = $this->get('request')->getSession()->get(SecurityContext::AUTHENTICATION_ERROR);
     }
     $pages = $this->getDoctrine()->getRepository('AppBundle:Page')->findAll();
     return array('error' => $error, 'pages' => $pages);
 }
开发者ID:Quiss,项目名称:Oon,代码行数:30,代码来源:AuthController.php

示例4: execute

 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $doctrine = $this->getContainer()->get('doctrine');
     $username = $input->getArgument('username');
     $password = $input->getArgument('password');
     $user = new User($username, $password);
     $roles = ['ROLE_USER', 'ROLE_API'];
     if ($input->hasOption('roles')) {
         $roles = array_merge($roles, $input->getOption('roles'));
     }
     $user->setRoles($roles);
     if ($input->hasOption('firstName')) {
         $user->setFirstName($input->getOption('firstName'));
     }
     if ($input->hasOption('lastName')) {
         $user->setLastName($input->getOption('lastName'));
     }
     if ($input->hasOption('email')) {
         $user->setEmail($input->getOption('email'));
     }
     $manager = $doctrine->getManager();
     $manager->persist($user);
     $manager->flush($user);
     $output->writeln(sprintf('New user: <info>%s</info>, with password: <info>%s</info> created', $username, $password));
 }
开发者ID:drymek,项目名称:fcs-backend,代码行数:25,代码来源:CreateUserCommand.php

示例5: registerAction

 /**
  * @Route("/register", name="register")
  * @Template()
  */
 public function registerAction(Request $request)
 {
     if ($request->getMethod() == 'POST') {
         $manager = $this->getDoctrine()->getManager();
         $user = new User();
         $user->setUsername($request->request->get('username'));
         $user->setSalt(md5(time()));
         $encoder = new MessageDigestPasswordEncoder('sha512', true, 10);
         $password = $encoder->encodePassword($request->request->get('password'), $user->getSalt());
         $user->setPassword($password);
         $user->setRoles('ROLE_UNCONFIRMED');
         $user->setLastName($request->request->get('lastName'));
         $user->setFirstName($request->request->get('firstName'));
         $user->setSurName('');
         $user->setPhone($request->request->get('phone'));
         $user->setCompany($request->request->get('companyTitle'));
         $manager->persist($user);
         $manager->flush($user);
         $manager->refresh($user);
         $session = new Session();
         $session->getFlashBag()->add('success', 'Ваша заявка принята. Пожалуйста, ожидайте подтверждения регистрации на указанный электронный адрес');
         @$this->get('email.service')->send(array($user->getUsername()), array('AppBundle:Email:registerNotifyUser.html.twig'), 'Сообщение от navigator mediaFirst');
         @$this->get('email.service')->send(array('tulupov.m@gmail.com', 'ryabova.t@mediafirst.ru', 'kravtsova.m@mediafirst.ru'), array('AppBundle:Email:registerNotify.html.twig'), 'Сообщение от navigator mediaFirst');
         return $this->redirect($this->generateUrl('homepage'));
     }
     return array();
 }
开发者ID:Quiss,项目名称:Oon,代码行数:31,代码来源:AuthController.php

示例6: load

 /**
  * {@inheritDoc}
  */
 public function load(ObjectManager $manager)
 {
     $user = new User('admin', 'admin');
     $user->setFirstName('Marcin');
     $user->setLastName('Dryka');
     $user->setEmail('marcin@dryka.pl');
     $user->setRoles(['ROLE_USER', 'ROLE_ADMIN', 'ROLE_API']);
     $manager->persist($user);
     $manager->flush();
 }
开发者ID:drymek,项目名称:fcs-backend,代码行数:13,代码来源:UserData.php

示例7: testSetUser

 public function testSetUser()
 {
     // new entity
     $wh = new WorkHistory();
     // dummy entity
     $user = new User();
     $user->setFirstName("Per");
     // Use the setUser method
     $wh->setUser($user);
     // Assert the result
     $this->assertEquals($user, $wh->getUser());
 }
开发者ID:vegardbb,项目名称:webpage,代码行数:12,代码来源:WorkHistoryEntityUnitTest.php

示例8: testSetUser

 public function testSetUser()
 {
     // new entity
     $post = new Post();
     // dummy entity
     $user = new User();
     $user->setFirstName("Ole");
     // Use the setUser method
     $post->setUser($user);
     // Assert the result
     $this->assertEquals($user, $post->getUser());
 }
开发者ID:vegardbb,项目名称:webpage,代码行数:12,代码来源:PostEntityUnitTest.php

示例9: testSetUser

 public function testSetUser()
 {
     // new entity
     $cr = new CertificateRequest();
     // dummy entity
     $user = new User();
     $user->setFirstName("Thomas");
     // Use the setUser method
     $cr->setUser($user);
     // Assert the result
     $this->assertEquals($user, $cr->getUser());
 }
开发者ID:vegardbb,项目名称:webpage,代码行数:12,代码来源:CertificateRequestEntityUnitTest.php

示例10: 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

示例11: updateUserInfosWithLdap

 /**
  * @param User $user
  */
 public function updateUserInfosWithLdap(User $user)
 {
     try {
         $datas = $this->ldap->getDataByUid($user->getUsername());
         $user->setFirstName($datas['givenname'][0]);
         $user->setLastName($datas['sn'][0]);
         $user->setEmail($datas['mail'][0]);
         $user->setPlainPassword(md5(uniqid(rand(), true)));
         $user->setPhoto(base64_encode($datas['jpegphoto'][0]));
     } catch (\Exception $e) {
         throw new UsernameNotFoundException(sprintf('Impossible de trouver %s dans le LDAP', $user->getUsername()));
     }
 }
开发者ID:sghribi,项目名称:garopi,代码行数:16,代码来源:UserService.php

示例12: testSetUser

 public function testSetUser()
 {
     // new assistantHistory entity
     $assistantHistory = new AssistantHistory();
     // New user entity
     $user = new User();
     // Fill in some random data to the user entity
     $user->setFirstName("Per");
     $user->setLastName("Olsen");
     $user->setUsername("petjo");
     // Use the setUser method for assistantHistory
     $assistantHistory->setUser($user);
     // Assert the result
     $this->assertEquals("petjo", $assistantHistory->getUser()->getUsername());
 }
开发者ID:aestene,项目名称:webpage,代码行数:15,代码来源:AssistantHistoryEntityUnitTest.php

示例13: load

 /**
  * Load data fixtures with the passed EntityManager
  *
  *
  */
 public function load(ObjectManager $manager)
 {
     $toto = new User();
     $toto->setFirstName('toto');
     $toto->setEmail('toto@toto.org');
     $toto->setAdresse('12 toto rue des entrepreneurs 75015 Paris');
     $toto->setTelephone('1234567898');
     $titi = new User();
     $titi->setFirstName('titi');
     $titi->setEmail('titi@titi.org');
     $titi->setAdresse('11 titi rue des entrepreneurs 75015 Paris');
     $titi->setTelephone('1234567898');
     $manager->persist($toto);
     $manager->persist($titi);
     $manager->flush();
 }
开发者ID:loicdev,项目名称:apprest,代码行数:21,代码来源:LoadUserData.php

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

示例15: load

 /**
  * {@inheritDoc}
  */
 public function load(ObjectManager $manager)
 {
     $userAdmin = new User();
     $userAdmin->setUsername('admin');
     $userAdmin->setPlainPassword('test');
     $userAdmin->setEmail('tournoibgf2015@gmail.com');
     $userAdmin->setEnabled(true);
     $userAdmin->setRoles(array('ROLE_ADMIN'));
     $userAdmin->setFirstName('Admin');
     $userAdmin->setLastName('Website');
     $userAdmin->setTelephone('0000000000');
     $manager->persist($userAdmin);
     $userNendredi = new User();
     $userNendredi->setUsername('nendredi');
     $userNendredi->setPlainPassword('toto');
     $userNendredi->setEmail('nicolas.endredi@gmail.com');
     $userNendredi->setEnabled(true);
     $userNendredi->setRoles(array('ROLE_USER'));
     $userNendredi->setFirstName('Nicolas');
     $userNendredi->setLastName('Endredi');
     $userNendredi->setTelephone('0000000000');
     $userNendredi->setTournament($this->getReference('lol-game'));
     $userNendredi->setExperience($this->getReference('kira'));
     $manager->persist($userNendredi);
     $userJK = new User();
     $userJK->setUsername('XxXXKillerXXxX');
     $userJK->setPlainPassword('toto');
     $userJK->setEmail('jean-kevin.dupont@yopmail.com');
     $userJK->setEnabled(true);
     $userJK->setRoles(array('ROLE_USER'));
     $userJK->setFirstName('Jean-Kévin');
     $userJK->setLastName('Dupont');
     $userJK->setTelephone('0000000000');
     $userJK->setTournament($this->getReference('csgo-game'));
     $userJK->setExperience($this->getReference('killer'));
     $manager->persist($userJK);
     $manager->flush();
     $this->addReference('admin-user', $userAdmin);
     $this->addReference('nendredi-user', $userNendredi);
     $this->addReference('jk-user', $userJK);
 }
开发者ID:AB2G,项目名称:abgg-symfony,代码行数:44,代码来源:LoadUserData.php


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