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


PHP User::setEmail方法代码示例

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


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

示例1: setUp

 public function setUp()
 {
     $this->user = new User();
     $this->user->setUsername('test');
     $this->user->setEmail('test@example.com');
     $this->user->setPassword('test');
     $this->log = new StressLog();
     $this->log->setLocaltime(new \DateTime());
     $this->log->setLevel(6);
     $this->log->setUser($this->user);
 }
开发者ID:jasongrimes,项目名称:stressmonkey,代码行数:11,代码来源:StressLogTest.php

示例2: loadUserByOAuthUserResponse

 /**
  * {@inheritdoc}
  */
 public function loadUserByOAuthUserResponse(UserResponseInterface $response)
 {
     $userEmail = $response->getEmail();
     $user = $this->userManager->findUserByEmail($userEmail);
     // if null just create new user and set it properties
     if (null === $user) {
         $userData = $response->getResponse();
         $user = new User();
         $user->setUsername($userData['formattedName']);
         $user->setPlainPassword(rand(1000000, 10000000));
         //TODO:find a better option
         //TODO: add location, company name, ..
         $user->setEmail($response->getEmail());
         $user->setEnabled(true);
         $this->userManager->updateUser($user);
         $this->em->flush();
         return $user;
     }
     // else update access token of existing user
     $serviceName = $response->getResourceOwner()->getName();
     $setter = 'set' . ucfirst($serviceName) . 'AccessToken';
     $user->{$setter}($response->getAccessToken());
     //update access token
     return $user;
 }
开发者ID:OpenSkills,项目名称:skillsprofile,代码行数:28,代码来源:MyFOSUBUserProvider.php

示例3: load

 public function load(ObjectManager $manager)
 {
     $userAdmin = new User();
     $userAdmin->setFname('Ade');
     $userAdmin->setLname('Arce');
     $userAdmin->setEmail('ade@example.com.studionone');
     $userAdmin->setPassword('password');
     $userAdmin2 = new User();
     $userAdmin2->setFname('Bob');
     $userAdmin2->setLname('Brush');
     $userAdmin2->setEmail('bob@example.com.studionone');
     $userAdmin2->setPassword('password');
     $userAdmin3 = new User();
     $userAdmin3->setFname('Cat');
     $userAdmin3->setLname('Capther');
     $userAdmin3->setEmail('cat@example.com.studionone');
     $userAdmin3->setPassword('password');
     $manager->persist($userAdmin);
     $manager->persist($userAdmin2);
     $manager->persist($userAdmin3);
     $manager->flush();
     $this->addReference('user_one', $userAdmin);
     $this->addReference('user_two', $userAdmin2);
     $this->addReference('user_three', $userAdmin3);
 }
开发者ID:uniraymond,项目名称:symfony-example,代码行数:25,代码来源:LoadUserData.php

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

示例5: load

 public function load(ObjectManager $manager)
 {
     $passwordEncoder = $this->container->get('security.password_encoder');
     $user_user = new User();
     $user_user->setUsername('user_user');
     $user_user->setEmail('user_user@blog.com');
     $user_user->setRoles(array('ROLE_USER'));
     $user_user->setEnabled(true);
     $encodedPassword = $passwordEncoder->encodePassword($user_user, 'qweasz');
     $user_user->setPassword($encodedPassword);
     $manager->persist($user_user);
     $user_admin = new User();
     $user_admin->setUsername('user_admin');
     $user_admin->setEmail('user_admin@blog.com');
     $user_admin->setRoles(array('ROLE_ADMIN'));
     $user_admin->setEnabled(true);
     $encodedPassword = $passwordEncoder->encodePassword($user_admin, 'qweasz');
     $user_admin->setPassword($encodedPassword);
     $manager->persist($user_admin);
     $user_moderator = new User();
     $user_moderator->setUsername('user_moderator');
     $user_moderator->setEmail('user_moderator@blog.com');
     $user_moderator->setRoles(array('ROLE_MODERATOR'));
     $user_moderator->setEnabled(true);
     $encodedPassword = $passwordEncoder->encodePassword($user_moderator, 'qweasz');
     $user_moderator->setPassword($encodedPassword);
     $manager->persist($user_moderator);
     $manager->flush();
 }
开发者ID:syrotchukandrew,项目名称:blog,代码行数:29,代码来源:LoadUserData.php

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

示例7: loadPosts

 private function loadPosts(ObjectManager $manager)
 {
     $passwordEncoder = $this->container->get('security.password_encoder');
     $user = new User();
     $user->setUsername('vvasia');
     $user->setDisplayName('Vasia Vasin');
     $user->setEmail('v.vasin_fake@levi9.com');
     $user->setUuid('uuid');
     $encodedPassword = $passwordEncoder->encodePassword($user, 'password');
     $user->setPassword($encodedPassword);
     $user->setRoles(['ROLE_USER']);
     $manager->persist($user);
     $manager->flush();
     /** @var User $author */
     $author = $manager->getRepository('AppBundle:User')->findOneBy(['email' => 'fakeuser2@levi9.com']);
     foreach (range(1, 10) as $i) {
         $post = new Post();
         $post->setTitle($this->getRandomPostTitle() . ' ' . uniqid())->setSummary($this->getRandomPostSummary())->setSlug($this->container->get('slugger')->slugify($post->getTitle()))->setContent($this->getPostContent())->setAuthor($author)->setPublishedAt(new \DateTime('now - ' . $i . 'days'))->setState($this->getRandomState())->setCategory($category);
         foreach (range(1, 5) as $j) {
             $comment = new Comment();
             $comment->setUser($user)->setPublishedAt(new \DateTime('now + ' . ($i + $j) . 'seconds'))->setContent($this->getRandomCommentContent())->setPost($post);
             $manager->persist($comment);
             $post->addComment($comment);
         }
         if (rand(0, 1)) {
             $vote = new Vote();
             $vote->setAuthorEmail(rand(0, 1) ? 'fakeuser2@levi9.com' : 'fakeuser1@levi9.com');
             $vote->setPost($post);
             $vote->setVote(rand(0, 1));
         }
         $manager->persist($post);
         $category->addPost($post);
     }
     $manager->flush();
 }
开发者ID:stanislav-sulima,项目名称:levi9voter,代码行数:35,代码来源:LoadFixtures.php

示例8: loadUsers

 private function loadUsers(ObjectManager $manager)
 {
     $passwordEncoder = $this->container->get('security.password_encoder');
     $johnUser = new User();
     $johnUser->setUsername('john_user');
     $johnUser->setEmail('john_user@symfony.com');
     $encodedPassword = $passwordEncoder->encodePassword($johnUser, 'kitten');
     $johnUser->setPassword($encodedPassword);
     $manager->persist($johnUser);
     $annaAdmin = new User();
     $annaAdmin->setUsername('anna_admin');
     $annaAdmin->setEmail('anna_admin@symfony.com');
     $annaAdmin->setRoles(array('ROLE_ADMIN'));
     $encodedPassword = $passwordEncoder->encodePassword($annaAdmin, 'kitten');
     $annaAdmin->setPassword($encodedPassword);
     $manager->persist($annaAdmin);
     $avantripAdmin = new User();
     $avantripAdmin->setUsername('admin');
     $avantripAdmin->setEmail('info@avantrip.com');
     $avantripAdmin->setRoles(array('ROLE_ADMIN'));
     $encodedPassword = $passwordEncoder->encodePassword($avantripAdmin, 'adminavantrip');
     $avantripAdmin->setPassword($encodedPassword);
     $manager->persist($avantripAdmin);
     $manager->flush();
 }
开发者ID:jbarad,项目名称:symfony_demo,代码行数:25,代码来源:LoadFixtures.php

示例9: createAction

 public function createAction($format)
 {
     try {
         $em = $this->getDoctrine()->getManager();
         $user = new User();
         $params = array();
         $content = $this->get("request")->getContent();
         if (!empty($content)) {
             $params = json_decode($content, true);
             $user->setConfirmationToken($params['confirmationToken']);
             $user->setCredentialsExpireAt($params['credentialsExpireAt']);
             $user->setCredentialsExpired($params['credentialsExpired']);
             $user->setEmail($params['email']);
             $user->setEmailCanonical($params['emailCanonical']);
             $user->setEnabled($params['enabled']);
             $user->setExpired($params['expired']);
             $user->setExpiresAt($params['expiresAt']);
             $user->setLastLogin($params['lastLogin']);
             $user->setLocked($params['locked']);
             $user->setPassword($params['password']);
             $user->setPasswordRequestedAt($params['passwordRequestedAt']);
             $user->setRoles($params['roles']);
             $user->setSalt($params['salt']);
             $user->setUsername($params['username']);
             $user->setUsernameCanonical($params['usernameCanonical']);
         }
         $em->persist($user);
         $em->flush();
         return $this->formatResponse("ok", $format);
     } catch (Exception $ex) {
         return $this->formatResponse("error", $format);
     }
 }
开发者ID:dowrow,项目名称:Symfony-REST,代码行数:33,代码来源:UserController.php

示例10: createUserAction

 /**
  * handles the creation of a new User
  * @Route("/register/create", name="create_user")
  */
 public function createUserAction()
 {
     $errorMessage = "";
     $successMessage = "";
     $defaultValues = ['username' => "", 'password' => "", 'passwordconfirm' => "", 'email' => ""];
     // get POST request
     $request = Request::createFromGlobals();
     $username = $request->request->get('username');
     $email = $request->request->get('email');
     $password = $request->request->get('password');
     $passwordconfirm = $request->request->get('passwordconfirm');
     //checks what fields are blank
     if (empty($username) || empty($email) || empty($password) || empty($passwordconfirm)) {
         $errorMessage = "Sie müssen alle Felder ausfüllen!";
         $defaultValues = ['username' => $username, 'password' => $password, 'passwordconfirm' => $passwordconfirm, 'email' => $email];
     } elseif ($password !== $passwordconfirm) {
         $errorMessage = "Die Passwörter müssen übereinstimmen!";
         $defaultValues = ['username' => $username, 'password' => "", 'passwordconfirm' => "", 'email' => $email];
     } else {
         //writes the the new User in the Database
         $user = new User();
         $user->setUsername($username);
         $user->setPassword(password_hash($password, PASSWORD_BCRYPT, array('cost' => 12)));
         $user->setEmail($email);
         $user->setRoles(array('ROLE_USER'));
         $em = $this->getDoctrine()->getManager();
         $em->persist($user);
         $em->flush();
         $successMessage = "Benutzer wurde erfolgreich angelegt!";
     }
     return $this->render('AppBundle:Account:register.html.twig', array('errorMessage' => $errorMessage, 'successMessage' => $successMessage, 'defaultValues' => $defaultValues));
 }
开发者ID:TobiasFranek,项目名称:rating,代码行数:36,代码来源:AccountController.php

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

示例12: load

 public function load(ObjectManager $manager)
 {
     /** @var EncoderFactoryInterface */
     $factory = $this->container->get('security.encoder_factory');
     $john = new User();
     $john->setUsername('john');
     $john->setEmail('john@spotizer.com');
     $john->setRoles(array('ROLE_USER'));
     $john->setEnabled(true);
     $encoder = $factory->getEncoder($john);
     $password = $encoder->encodePassword('john', $john->getSalt());
     $john->setPassword($password);
     $john->setApiToken('abcdefgh');
     $manager->persist($john);
     $sofia = new User();
     $sofia->setUsername('sofia');
     $sofia->setEmail('sofia@spotizer.com');
     $sofia->setRoles(array('ROLE_USER'));
     $sofia->setEnabled(true);
     $encoder = $factory->getEncoder($sofia);
     $password = $encoder->encodePassword('sofia', $sofia->getSalt());
     $sofia->setPassword($password);
     $sofia->setApiToken('1234567');
     $manager->persist($sofia);
     $manager->flush();
 }
开发者ID:FlorianLB,项目名称:formation-sf-dec15,代码行数:26,代码来源:LoadUser.php

示例13: getUser

 public function getUser($authorizationCode, UserProviderInterface $userProvider)
 {
     $provider = $this->getFacebookOAuthProvider();
     try {
         // the credentials are really the access token
         $accessToken = $provider->getAccessToken('authorization_code', ['code' => $authorizationCode]);
     } catch (IdentityProviderException $ex) {
         $response = $e->getResponseBody();
         $errorCode = $response['error']['code'];
         $message = $response['error']['message'];
         //var_dump($response);
         //TODO throw a custom error to handle ???
     }
     $fbUser = $provider->getResourceOwner($accessToken);
     $email = $fbUser->getEmail();
     $em = $this->container->get('doctrine')->getManager();
     $user = $em->getRepository('AppBundle:User')->findOneBy(['email' => $email]);
     //If there is no user, we need to create one
     if (!$user) {
         $user = new User();
         $user->setUsername($email);
         $user->setEmail($email);
         //Set to unencoded password.
         //Since passwords are encode when checked, users should not be able to login using it
         $user->setPassword('FACEBOOK LOGIN');
         //Make sure that a user has at least the role of ROLE_USER when created
         $roles = $user->getRoles();
         $user->setRoles($roles);
     }
     $user->setFacebookId($fbUser->getId());
     $em->persist($user);
     $em->flush();
     return $user;
 }
开发者ID:TomasVotruba,项目名称:symfony-guard-project,代码行数:34,代码来源:FacebookAuthenticator.php

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

示例15: load

 /**
  * {@inheritdoc}
  */
 public function load(ObjectManager $manager)
 {
     $passwordEncoder = $this->container->get('security.password_encoder');
     $joeUser = new User();
     $joeUser->setUsername('joe_user');
     $joeUser->setEmail('joe.user@app.com');
     $encodedPassword = $passwordEncoder->encodePassword($joeUser, 'pa$$word');
     $joeUser->setPassword($encodedPassword);
     $joeUser->setEnabled(true);
     $manager->persist($joeUser);
     $this->setReference('user-joe_user', $joeUser);
     $johnAdmin = new User();
     $johnAdmin->setUsername('john_admin');
     $johnAdmin->setEmail('john.admin@app.com');
     $johnAdmin->setRoles(array('ROLE_ADMIN'));
     $encodedPassword = $passwordEncoder->encodePassword($johnAdmin, 'pa$$word');
     $johnAdmin->setPassword($encodedPassword);
     $johnAdmin->setEnabled(true);
     $manager->persist($johnAdmin);
     $this->setReference('user-john_admin', $johnAdmin);
     $jackSuper = new User();
     $jackSuper->setUsername('jack_super');
     $jackSuper->setEmail('jack.super@app.com');
     $jackSuper->setRoles(array('ROLE_SUPER_ADMIN'));
     $encodedPassword = $passwordEncoder->encodePassword($jackSuper, 'pa$$word');
     $jackSuper->setPassword($encodedPassword);
     $jackSuper->setEnabled(true);
     $manager->persist($jackSuper);
     $this->setReference('user-jack_super', $jackSuper);
     $manager->flush();
 }
开发者ID:sandraf,项目名称:symfony2-project,代码行数:34,代码来源:LoadUserData.php


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