本文整理汇总了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);
}
示例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;
}
示例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);
}
示例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));
}
示例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();
}
示例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();
}
示例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());
}
示例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());
}
示例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());
}
示例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();
}
示例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()));
}
}
示例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());
}
示例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();
}
示例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;
}
示例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);
}