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


PHP User::setName方法代码示例

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


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

 /**
  * Load default users
  *
  * @param ObjectManager $manager
  */
 public function load(ObjectManager $manager)
 {
     $repository = $manager->getRepository('AppBundle:User');
     // Default admin
     $user = $repository->find(1);
     if ($user === null) {
         $user = new User();
         $user->setName('Test User');
         $user->setEmail('test@test.com');
         $encoder = $this->container->get('security.password_encoder');
         $password = $encoder->encodePassword($user, '123123');
         $user->setPassword($password);
         $user->setActive(true);
         $manager->persist($user);
     }
     $this->addReference('test-user', $user);
     // Test user
     $admin = $repository->find(2);
     if ($admin === null) {
         $admin = new User();
         $admin->setName('Test Admin');
         $admin->setEmail('admin@test.com');
         $encoder = $this->container->get('security.password_encoder');
         $password = $encoder->encodePassword($admin, 'password');
         $admin->setPassword($password);
         $admin->setActive(true);
         $manager->persist($admin);
     }
     $this->addReference('admin-user', $admin);
     $manager->flush();
 }
开发者ID:jducro,项目名称:music-school,代码行数:36,代码来源:UserFixture.php

示例3: startTestAction

 /**
  * @Route("/startTest", name="start_test")
  */
 public function startTestAction(Request $request)
 {
     $response = new Response();
     $response->headers->set('Content-Type', 'application/json');
     $data = json_decode($request->getContent(), true);
     $request->request->replace($data);
     //fetching user name
     if (!($userName = $request->request->get('user_name'))) {
         $response->setContent(json_encode(array('error' => 'Invalid name')));
         return $response;
     }
     //saving user
     $user = new User();
     $user->setName($userName);
     $user->setScore(0);
     $em = $this->getDoctrine()->getManager();
     $em->persist($user);
     $em->flush();
     //start sesssion
     $session = $request->getSession();
     $session->start();
     $session->set('user_id', $user->getId());
     $session->set('name', $user->getName());
     $session->set('score', $user->getScore());
     $session->set('errors_count', 0);
     $response->setContent(json_encode(array('success' => true)));
     return $response;
 }
开发者ID:virtyos,项目名称:dictionary,代码行数:31,代码来源:DefaultController.php

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

示例5: createAction

 /**
  * @return \Symfony\Component\HttpFoundation\Response
  */
 public function createAction()
 {
     $error = '';
     $name = $this->getRequest()->request->get('_username');
     $display_name = $this->getRequest()->request->get('_display_name');
     $password = $this->getRequest()->request->get('_password');
     // var_dump($password); die;
     $roleId = 2;
     $role = $this->getDoctrine()->getRepository('AppBundle:Role')->find($roleId);
     //var_dump($role_id); die;
     if ($this->_isUniqueUser($name)) {
         $user = new User();
         $user->setDisplayName($display_name);
         $user->setName($name);
         $user->setPassword($password);
         $user->setRole($role);
         $em = $this->getDoctrine()->getEntityManager();
         $em->persist($user);
         $em->flush();
         return $this->render('AppBundle:Security:login.html.twig', array('name' => $name, 'error' => ''));
     } else {
         $error = "Користувач з іменем " . $name . ' уже існує. Будь оригінальний';
     }
     return $this->render("AppBundle:Film:index.html.twig", array('name' => $name, 'error' => $error));
 }
开发者ID:ksenyagrabevnyk,项目名称:registration-symfony-project,代码行数:28,代码来源:UserController.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: createUserData

 /**
  * @param string $name
  * @return array
  */
 private function createUserData($name)
 {
     $entityManager = $this->getEntityManager();
     $apiKeyManager = $this->getApiKeyManager();
     $user = new User();
     $user->setName($name);
     $entityManager->persist($user);
     $entityManager->flush();
     $apiKey = $apiKeyManager->generateApiKeyForUser($user);
     return ['user' => $user, 'apiKey' => $apiKey];
 }
开发者ID:jlekowski,项目名称:battleships-api,代码行数:15,代码来源:AbstractApiTestCase.php

示例8: sodaDetail

 /**
  * @Route("/Seeddata", name="seed_data")
  */
 public function sodaDetail()
 {
     //Users
     $encoder = $this->container->get('security.password_encoder');
     $em = $this->getDoctrine()->getManager();
     $user1 = new User();
     $user1->setName("Adam");
     $user1->setUsername("adam42");
     $user1->setRole("ROLE_ADMIN");
     $user1->setPassword($encoder->encodePassword($user1, "1234"));
     $user2 = new User();
     $user2->setName("Peter");
     $user2->setUsername("peterhans");
     $user2->setRole("ROLE_USER");
     $user2->setPassword($encoder->encodePassword($user2, "1234"));
     $em->persist($user1);
     $em->persist($user2);
     $em->flush();
     //Sodas
     $em = $this->getDoctrine()->getManager();
     $storage1 = new Storage();
     $storage2 = new Storage();
     $storage3 = new Storage();
     $storage1->setQuantity(17);
     $storage2->setQuantity(27);
     $storage3->setQuantity(37);
     $soda1 = new Soda();
     $soda1->setName("Cola");
     $soda1->setPrice(13);
     $soda1->setDescription("Lækker original cola");
     $soda1->setImageurl("images/cola.jpg");
     $soda1->setStorage($storage1);
     $soda2 = new Soda();
     $soda2->setName("Sprite");
     $soda2->setPrice(23);
     $soda2->setDescription("Sprite direkte fra de friske kilder");
     $soda2->setImageurl("images/sprite.jpg");
     $soda2->setStorage($storage2);
     $soda3 = new Soda();
     $soda3->setName("Fanta");
     $soda3->setPrice(33);
     $soda3->setDescription("Fanta som man husker den");
     $soda3->setImageurl("images/fanta.jpg");
     $soda3->setStorage($storage3);
     $em->persist($soda1);
     $em->persist($soda2);
     $em->persist($soda3);
     $em->flush();
     return $this->redirectToRoute('soda_overview');
 }
开发者ID:nuller1joe,项目名称:Soda-HTML24,代码行数:53,代码来源:SeedController.php

示例9: load

 public function load(ObjectManager $manager)
 {
     $user = new User();
     $user->setName('nuovo');
     $user->setSurname('test');
     $encoder = $this->container->get('security.password_encoder');
     $password = $encoder->encodePassword($user, 'testtest');
     $user->setPassword($password);
     $user->setUsername('nuovo.test');
     $user->setEmail('francesco.viglino@email.com');
     $user->setEnabled(true);
     $manager->persist($user);
     $manager->flush();
     self::$users[] = $user;
 }
开发者ID:kawashita86,项目名称:gpanel,代码行数:15,代码来源:LoadUserData.php

示例10: load

 public function load(ObjectManager $manager)
 {
     for ($i = 0; $i < 100; $i++) {
         $user = new User();
         $infoUser = new InfoUser();
         $user->setName('Name' . $i);
         $user->setEmail('testname' . $i . '@dev.com');
         $datetimeNow = new \DateTime();
         $infoUser->setBirthdate($datetimeNow);
         $infoUser->setDescription('Esta es una descripcion personal de Name' . $i . '.');
         $user->setInfoUser($infoUser);
         $manager->persist($user);
         $manager->persist($infoUser);
     }
     $manager->flush();
 }
开发者ID:JuanLuisGarciaBorrego,项目名称:DoctrineLab,代码行数:16,代码来源:LoadUserData.php

示例11: load

 public function load(ObjectManager $manager)
 {
     foreach ($this->getAllUser() as $singleUser) {
         $user = new User();
         $user->setUsername($singleUser['username']);
         $user->setPlainPassword($singleUser['PlainPassword']);
         $user->setEmail($singleUser['Email']);
         $user->setEnabled(true);
         $user->addRole($singleUser['roles']);
         $user->setName($singleUser['name']);
         $user->setIsStaff($singleUser['isStaff']);
         $user->setSiteId($this->getContainer()->get('doctrine.orm.entity_manager')->getRepository('AppBundle:Site')->findBy(array('url' => $singleUser['siteId'])));
         $manager->persist($user);
     }
     $manager->flush();
 }
开发者ID:johnmackenzie91,项目名称:ClientDocumentArea,代码行数:16,代码来源:LoadUserData.php

示例12: addAction

 /**
  * @Route("/add", name="add")
  */
 public function addAction(Request $request)
 {
     if ($_SERVER["REQUEST_METHOD"] == "POST") {
         $data = json_decode($request->getContent(), true);
         $name = $data['userName'];
         $age = $data['userAge'];
         $user = new User();
         $user->setName($name);
         $user->setAge($age);
         $em = $this->getDoctrine()->getEntityManager();
         $em->persist($user);
         $em->flush();
         $id = $user->getId();
         return new Response(json_encode(array('userId' => $id)));
     }
 }
开发者ID:6O6OTik,项目名称:Sym-Ang,代码行数:19,代码来源:DefaultController.php

示例13: load

 public function load(ObjectManager $manager)
 {
     $users = [['name' => 'Admin', 'email' => 'admin@example.com', 'password' => 'admin'], ['name' => 'Normal', 'email' => 'normal@example.com', 'password' => 'normal']];
     foreach ($users as $user) {
         $entity = new User();
         $entity->setName($user['name']);
         $entity->setEmail($user['email']);
         $entity->setPassword($user['password']);
         $manager->persist($entity);
     }
     for ($i = 1; $i <= 30; $i++) {
         $entity = new User();
         $entity->setName("User #{$i}");
         $entity->setEmail("user{$i}@example.com");
         $entity->setPassword("user{$i}");
         $manager->persist($entity);
     }
     $manager->flush();
 }
开发者ID:ksdev-pl,项目名称:Symfony-Image-Archive,代码行数:19,代码来源:LoadUserData.php

示例14: registrationAction

 /**
  * @Route("/registration/{TrainingId}", name="registration")
  */
 public function registrationAction(Request $request, $TrainingId)
 {
     $returnData = array();
     $em = $this->getDoctrine()->getManager();
     $repositoryUserTraining = $this->getDoctrine()->getRepository('AppBundle:UserTraining');
     $returnData['TrainingUserCount'] = 0;
     $returnData['TrainingUserCount'] = $repositoryUserTraining->getUserCount()[0]['TrainingUserCount'];
     $data = $request->request->all();
     if (isset($data["Patvirtinti"])) {
         $returnData = $this->verificationRegistration($data, $returnData);
         if ($returnData["request"]) {
             $user = new User();
             $user->setName($data['userName']);
             $user->setSurname($data['userSurname']);
             $user->setEmail($data['userEmail']);
             $user->setPhone($data['userPhone']);
             $user->setWorker(false);
             $em->persist($user);
             $em->flush();
             $this->get('session')->set('UserId', $user->getId());
             $this->get('session')->set('UserName', $user->getName());
             $this->get('session')->set('UserSurname', $user->getSurname());
             $this->get('session')->set('worker', false);
             $repositoryUserTraining->setUserInTraining($user->getId(), $TrainingId);
         }
     }
     if (!is_null($this->get('session')->get('UserId'))) {
         $repositoryUserTraining->setUserInTraining($this->get('session')->get('UserId'), $TrainingId);
     }
     $repository = $this->getDoctrine()->getRepository('AppBundle:Training');
     $training = $repository->findById($TrainingId);
     if (!$training) {
         throw $this->createNotFoundException('');
     }
     $returnData['TrainingName'] = $training[0]->getTrainingName();
     $returnData['TrainingUserCountMax'] = $training[0]->getTrainingUserCount();
     $returnData['TrainingId'] = $training[0]->getId();
     return $this->render('default/registration.html.twig', ['data' => $returnData]);
 }
开发者ID:AlinaSoft,项目名称:my_school,代码行数:42,代码来源:DefaultController.php

示例15: createUserAction

 /**
  * @param Request $request
  *
  * @return JsonResponse
  */
 public function createUserAction(Request $request)
 {
     $entityManager = $this->getContainer()->get('doctrine.orm.entity_manager');
     //todo: Add some validation
     $username = $request->get('username');
     if ($username === null) {
         return new JsonResponse(['success' => 0, 'message' => 'username is missing'], Response::HTTP_BAD_REQUEST);
     }
     /** @var User $user */
     $user = $entityManager->getRepository('AppBundle:User')->find($username);
     if ($user !== null) {
         return new JsonResponse(['success' => 0, 'message' => 'user already exist'], Response::HTTP_BAD_REQUEST);
     }
     $user = new User($username);
     $name = $request->get('name');
     if ($name !== null) {
         $user->setName($name);
     }
     $entityManager->persist($user);
     $entityManager->flush();
     return new JsonResponse(['success' => 1, 'message' => 'user has been created']);
 }
开发者ID:asev,项目名称:user_group,代码行数:27,代码来源:MicroKernel.php


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