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


PHP User::setLastName方法代码示例

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


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

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

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

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

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

 public function load(ObjectManager $manager)
 {
     $faker = \Faker\Factory::create();
     $x = 0;
     while ($x++ < 25) {
         $team = $this->getReference("team-{$x}");
         $i = 0;
         while ($i++ < 14) {
             $player = new User();
             $player->setName($faker->firstName);
             $player->setLastName($faker->lastName);
             $player->setRole(User::ROLE_PLAYER);
             $player->setDescription($faker->text);
             $player->setTeam($team);
             $manager->persist($player);
             $manager->flush();
         }
         $i = 0;
         while ($i++ < 4) {
             $coach = new User();
             $coach->setName($faker->firstName);
             $coach->setLastName($faker->lastName);
             $coach->setRole(User::ROLE_COACH);
             $coach->setDescription($faker->text);
             $coach->setTeam($team);
             $manager->persist($coach);
             $manager->flush();
         }
     }
 }
开发者ID:Wolframcheg,项目名称:GeekhubHW7,代码行数:30,代码来源:LoadUsersData.php

示例6: load

 public function load(ObjectManager $manager)
 {
     $users = array(array('name' => 'Gabe', 'lastName' => 'Newell', 'surName' => '', 'email' => 'admin@arkusnexus.com', 'password' => 'admin', 'admissionDate' => '12-12-12', 'roles' => 'ROLE_ADMIN', 'image' => 'blog_newell1.jpg', 'positionId' => 1), array('name' => 'Kayla', 'lastName' => 'Person', 'surName' => '', 'email' => 'rh@arkusnexus.com', 'password' => 'rh', 'admissionDate' => '12-12-12', 'roles' => 'ROLE_RH', 'image' => 'Kayla_Person-small.jpg', 'positionId' => 1), array('name' => 'Alejandro', 'lastName' => 'Hernandez', 'surName' => 'Marquez', 'email' => 'user1@arkusnexus.com', 'password' => '1234', 'admissionDate' => '12-12-12', 'roles' => 'ROLE_USER', 'image' => 'MikePerson.jpg', 'positionId' => 1), array('name' => 'Bernardo', 'lastName' => 'Lemus', 'surName' => 'Ortiz', 'email' => 'user2@arkusnexus.com', 'password' => '1234', 'admissionDate' => '12-12-12', 'roles' => 'ROLE_USER', 'image' => 'ralf-a.jpg', 'positionId' => 1), array('name' => 'Christian', 'lastName' => 'Flores', 'surName' => 'Filis', 'email' => 'user3@arkusnexus.com', 'password' => '1234', 'admissionDate' => '12-12-12', 'roles' => 'ROLE_USER', 'image' => 'img_person.jpg', 'positionId' => 1), array('name' => 'David', 'lastName' => 'Acosta', 'surName' => 'Arellano', 'email' => 'user4@arkusnexus.com', 'password' => '1234', 'admissionDate' => '12-12-12', 'roles' => 'ROLE_USER', 'image' => 'person3.jpg', 'positionId' => 1), array('name' => 'Eric', 'lastName' => 'Martinez', 'surName' => 'Ibarra', 'email' => 'user5@arkusnexus.com', 'password' => '1234', 'admissionDate' => '12-12-12', 'roles' => 'ROLE_USER', 'image' => '3709.jpg', 'positionId' => 1), array('name' => 'Felipe', 'lastName' => 'Trejo', 'surName' => 'Contreras', 'email' => 'user6@arkusnexus.com', 'password' => '1234', 'admissionDate' => '12-12-12', 'roles' => 'ROLE_USER', 'image' => 'people_with_arthritis.jpg', 'positionId' => 1), array('name' => 'Gerardo', 'lastName' => 'Garcia', 'surName' => 'Najera', 'email' => 'user7@arkusnexus.com', 'password' => '1234', 'admissionDate' => '12-12-12', 'roles' => 'ROLE_USER', 'image' => 'img-02.jpg', 'positionId' => 1), array('name' => 'Hugo', 'lastName' => 'Ruiz', 'surName' => 'Sanchez', 'email' => 'user8@arkusnexus.com', 'password' => '1234', 'admissionDate' => '12-12-12', 'roles' => 'ROLE_USER', 'image' => 'img-10.jpg', 'positionId' => 1), array('name' => 'Ignacio', 'lastName' => 'Corona', 'surName' => 'Silva', 'email' => 'user9@arkusnexus.com', 'password' => '1234', 'admissionDate' => '12-12-12', 'roles' => 'ROLE_USER', 'image' => 'img-12.jpg', 'positionId' => 1), array('name' => 'Javier', 'lastName' => 'Reyes', 'surName' => 'Leon', 'email' => 'user10@arkusnexus.com', 'password' => '1234', 'admissionDate' => '12-12-12', 'roles' => 'ROLE_USER', 'image' => 'img-13.jpg', 'positionId' => 1), array('name' => 'Karla', 'lastName' => 'Juarez', 'surName' => 'Mejia', 'email' => 'user11@arkusnexus.com', 'password' => '1234', 'admissionDate' => '12-12-12', 'roles' => 'ROLE_USER', 'image' => 'images.jpg', 'positionId' => 1), array('name' => 'Lorenzo', 'lastName' => 'Escoto', 'surName' => 'Villalobos', 'email' => 'user12@arkusnexus.com', 'password' => '1234', 'admissionDate' => '12-12-12', 'roles' => 'ROLE_USER', 'image' => 'img-21.jpg', 'positionId' => 1), array('name' => 'Steve', 'lastName' => 'Jobs', 'surName' => '', 'email' => 'user13@arkusnexus.com', 'password' => '1234', 'admissionDate' => '12-12-12', 'roles' => 'ROLE_USER', 'image' => 'Jobs0212120.jpg', 'positionId' => 1), array('name' => 'Nestor', 'lastName' => 'Salinas', 'surName' => 'Morales', 'email' => 'user14@arkusnexus.com', 'password' => 'admin', 'admissionDate' => '12-12-12', 'roles' => 'ROLE_USER', 'image' => 'person2.jpg', 'positionId' => 1), array('name' => 'Omar', 'lastName' => 'Torres', 'surName' => 'Zavaleta', 'email' => 'user15@arkusnexus.com', 'password' => '1234', 'admissionDate' => '12-12-12', 'roles' => 'ROLE_USER', 'image' => 'person-detail.jpg', 'positionId' => 1), array('name' => 'Pedro', 'lastName' => 'Romero', 'surName' => 'Flores', 'email' => 'user16@arkusnexus.com', 'password' => '1234', 'admissionDate' => '12-12-12', 'roles' => 'ROLE_USER', 'image' => 'poy_nomination_agassi.jpg', 'positionId' => 1), array('name' => 'Ruben', 'lastName' => 'Aceves', 'surName' => 'Nieto', 'email' => 'user17@arkusnexus.com', 'password' => '1234', 'admissionDate' => '12-12-12', 'roles' => 'ROLE_USER', 'image' => 'person4.jpg', 'positionId' => 1), array('name' => 'Santiago', 'lastName' => 'Soriano', 'surName' => 'Aguilar', 'email' => 'user18@arkusnexus.com', 'password' => '1234', 'admissionDate' => '12-12-12', 'roles' => 'ROLE_USER', 'image' => 'dan-misener-600_1.jpg', 'positionId' => 1), array('name' => 'Barack', 'lastName' => 'Obama', 'surName' => '', 'email' => 'user19@arkusnexus.com', 'password' => '1234', 'admissionDate' => '12-12-12', 'roles' => 'ROLE_USER', 'image' => 'u-s-president-barack-obama.jpg', 'positionId' => 1), array('name' => 'Robin', 'lastName' => 'Williams', 'surName' => '', 'email' => 'user20@arkusnexus.com', 'password' => '1234', 'admissionDate' => '12-12-12', 'roles' => 'ROLE_USER', 'image' => 'tumblr.jpg', 'positionId' => 1), array('name' => 'Bill', 'lastName' => 'Gates', 'surName' => '', 'email' => 'user21@arkusnexus.com', 'password' => '1234', 'admissionDate' => '12-12-12', 'roles' => 'ROLE_USER', 'image' => 'bill-gates.jpg', 'positionId' => 1), array('name' => 'Kim', 'lastName' => 'Jong', 'surName' => 'Un', 'email' => 'user22@arkusnexus.com', 'password' => '1234', 'admissionDate' => '12-12-12', 'roles' => 'ROLE_USER', 'image' => 'kwc.jpg', 'positionId' => 1), array('name' => 'Vladimir', 'lastName' => 'Putin', 'surName' => '', 'email' => 'user23@arkusnexus.com', 'password' => 'admin', 'admissionDate' => '12-12-12', 'roles' => 'ROLE_USER', 'image' => 'putinwink.jpg', 'positionId' => 1));
     // Cuando se haga el 'seed' de Usuarios se pondran Roles por default
     // Role : Colaborador
     // $repository = $manager
     // ->getRepository('AppBundle:Role');
     // $roleEntity = $repository->find(1);
     // Position : Software Developer
     $repository = $manager->getRepository('AppBundle:Position');
     $positionEntity = $repository->find(1);
     // dump($roleentity);
     // $roleentity = new Role();
     // $roleentity->setName("ROL NO REAL");
     // $positionentity = new Position();
     // $positionentity->setName("POSICION NO REAL");
     foreach ($users as $user) {
         $entity = new User();
         $entity->setName($user['name']);
         $entity->setLastName($user['lastName']);
         $entity->setSurName($user['surName']);
         $entity->setUsername($user['email']);
         $entity->setPassword($user['password']);
         $entity->setAdmissionDate(new \DateTime("now"));
         $entity->setImage($user['image']);
         $entity->setRoles($user['roles']);
         $entity->setPosition($positionEntity);
         $manager->persist($entity);
     }
     $manager->flush();
 }
开发者ID:ebuzz,项目名称:skillSearcher,代码行数:31,代码来源:Users.php

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

示例8: testSetLastName

 public function testSetLastName()
 {
     // new entity
     $user = new User();
     // Use the setLastName method
     $user->setLastName("olsen");
     // Assert the result
     $this->assertEquals("olsen", $user->getLastName());
 }
开发者ID:vegardbb,项目名称:webpage,代码行数:9,代码来源:UserEntityUnitTest.php

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

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

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

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

示例13: registerAction

 /**
  * @Route("/registered", name="registered", options={"expose"=true})
  * @Method("POST")
  */
 public function registerAction(Request $request)
 {
     $success = "";
     $flag = true;
     $em = $this->getDoctrine()->getManager();
     $mail = $request->get('exist');
     if ($mail == "true") {
         return $this->render('AppBundle:Security:login.html.twig', array('exist' => 'exist', 'success' => $success));
     }
     $user = new User();
     $user->setName($request->get('name'));
     $user->setLastName($request->get('lastName'));
     $user->setPassword($request->get('password'));
     $user->setUsername($request->get('email'));
     $user->setRoles('ROLE_USER');
     $user->setAdmissionDate(null);
     $em->persist($user);
     $em->flush();
     $user->getUserId();
     $token = new UsernamePasswordToken($user, null, 'default', $user->getRoles());
     $this->get('security.token_storage')->setToken($token);
     return $this->redirect($this->generateUrl('user_edit', array('id' => $user->getUserId(), 'flag' => $flag)));
 }
开发者ID:ebuzz,项目名称:skillSearcher,代码行数:27,代码来源:DefaultController.php

示例14: load

 public function load(ObjectManager $manager)
 {
     /**
      * *********************
      *        Users
      * *********************
      */
     $faker = Factory::create('fr_FR');
     $users = [];
     $userAdmin = new User();
     $userAdmin->setUsername('admin');
     $userAdmin->setEmail('borisschapira+admin@gmail.com');
     $userAdmin->setRoles(['ROLE_ADMIN']);
     $userAdmin->setEnabled(true);
     $userAdmin->setPlainPassword('admin');
     $userAdmin->setFirstName($faker->firstName);
     $userAdmin->setLastName($faker->lastName);
     $manager->persist($userAdmin);
     $users[] = $userAdmin;
     for ($i = 0; $i < 10; $i++) {
         $userUser = new User();
         $userUser->setUsername($faker->userName);
         $userUser->setEmail('borisschapira+user' . $i . '@gmail.com');
         $userUser->setRoles(['ROLE_USER']);
         $userUser->setEnabled(true);
         $userUser->setPlainPassword('user');
         $userUser->setFirstName($faker->firstName);
         $userUser->setLastName($faker->lastName);
         $manager->persist($userUser);
         $users[] = $userUser;
     }
     /**
      * *********************
      *        Categories
      * *********************
      */
     $categoryData = ['Voyage' => 'voyage', 'Multimédia' => 'multimedia', 'Animaux' => 'animaux', 'Mode' => 'mode', 'Sport' => 'sport', 'Décoration' => 'deco', 'Culture' => 'culture', 'Jardinage' => 'jardinage'];
     $categories = [];
     foreach ($categoryData as $name => $slug) {
         $category = new Category();
         $category->setName($name);
         $category->setSlug($slug);
         $manager->persist($category);
         $categories[] = $category;
     }
     /**
      * *********************
      *        Wishes
      * *********************
      */
     foreach ($users as $user) {
         for ($i = 0; $i < 10; $i++) {
             $wish = new Wish();
             $wish->setTitle($faker->sentence($nbWords = 12, $variableNbWords = true));
             $wish->setDescription($faker->paragraph($nbSentences = 3, $variableNbSentences = true));
             $wish->setUser($user);
             $wish->setCategory($categories[rand(0, count($categories) - 1)]);
             if (rand(0, 9) % 3 == 0) {
                 $wish->setLink('https://borisschapira.com');
             }
             $manager->persist($wish);
         }
     }
     $manager->flush();
 }
开发者ID:MakeAWish,项目名称:mawDevs2,代码行数:65,代码来源:LoadUserData.php

示例15: load

 public function load(ObjectManager $manager)
 {
     $user1 = new User();
     $user1->setIsActive('1');
     $user1->setEmail('petter@stud.ntnu.no');
     $user1->setFirstName('Petter');
     $user1->setLastName('Johansen');
     $user1->setGender('0');
     $user1->setPhone('95347865');
     $user1->setUserName('petjo');
     $user1->setPassword('1234');
     $user1->addRole($this->getReference('role-4'));
     $user1->setFieldOfStudy($this->getReference('fos-1'));
     $user1->setPicturePath('images/defaultProfile.png');
     $manager->persist($user1);
     $user2 = new User();
     $user2->setIsActive('1');
     $user2->setEmail('ida@stud.ntnu.no');
     $user2->setFirstName('Ida');
     $user2->setLastName('Andreassen');
     $user2->setGender('1');
     $user2->setPhone('95267841');
     $user2->setUserName('idaan');
     $user2->setPassword('1234');
     $user2->addRole($this->getReference('role-1'));
     $user2->setFieldOfStudy($this->getReference('fos-2'));
     $user2->setPicturePath('images/defaultProfile.png');
     $manager->persist($user2);
     $user3 = new User();
     $user3->setIsActive('1');
     $user3->setEmail('kristoffer@stud.ntnu.no');
     $user3->setFirstName('Kristoffer');
     $user3->setLastName('Bø');
     $user3->setGender('0');
     $user3->setPhone('95148725');
     $user3->setUserName('kribo');
     $user3->setPassword('1234');
     $user3->addRole($this->getReference('role-1'));
     $user3->setFieldOfStudy($this->getReference('fos-3'));
     $user3->setPicturePath('images/defaultProfile.png');
     $manager->persist($user3);
     $user4 = new User();
     $user4->setIsActive('1');
     $user4->setEmail('alm@mail.com');
     $user4->setFirstName('Thomas');
     $user4->setLastName('Alm');
     $user4->setGender('0');
     $user4->setPhone('12312312');
     $user4->setUserName('thomas');
     $user4->setPassword('123');
     $user4->addRole($this->getReference('role-1'));
     $user4->setFieldOfStudy($this->getReference('fos-1'));
     $user4->setPicturePath('images/defaultProfile.png');
     $manager->persist($user4);
     $user5 = new User();
     $user5->setIsActive('1');
     $user5->setEmail('a@b.c');
     $user5->setFirstName('Reidun');
     $user5->setLastName('Persdatter Ødegaard');
     $user5->setGender('1');
     $user5->setPhone('92269548');
     $user5->setUserName('reidun');
     $user5->setPassword('123');
     $user5->addRole($this->getReference('role-4'));
     $user5->setFieldOfStudy($this->getReference('fos-1'));
     $user5->setPicturePath('images/defaultProfile.png');
     $manager->persist($user5);
     $user6 = new User();
     $user6->setIsActive('1');
     $user6->setEmail('b@b.c');
     $user6->setFirstName('Siri');
     $user6->setLastName('Brenna Eskeland');
     $user6->setGender('1');
     $user6->setPhone('99540025');
     $user6->setUserName('siri');
     $user6->setPassword('123');
     $user6->addRole($this->getReference('role-4'));
     $user6->setFieldOfStudy($this->getReference('fos-1'));
     $user6->setPicturePath('images/defaultProfile.png');
     $manager->persist($user6);
     $user7 = new User();
     $user7->setIsActive('1');
     $user7->setEmail('c@b.c');
     $user7->setFirstName('Eirik');
     $user7->setLastName('Myrvoll-Nilsen');
     $user7->setGender('0');
     $user7->setPhone('93093824');
     $user7->setUserName('eirik');
     $user7->setPassword('123');
     $user7->addRole($this->getReference('role-2'));
     $user7->setFieldOfStudy($this->getReference('fos-1'));
     $user7->setPicturePath('images/defaultProfile.png');
     $manager->persist($user7);
     $user8 = new User();
     $user8->setIsActive('1');
     $user8->setEmail('d@b.c');
     $user8->setFirstName('Ruben');
     $user8->setLastName('Ravnå');
     $user8->setGender('0');
     $user8->setPhone('98059155');
//.........这里部分代码省略.........
开发者ID:vegardbb,项目名称:webpage,代码行数:101,代码来源:LoadUserData.php


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