本文整理汇总了PHP中AppBundle\Entity\User::setSurname方法的典型用法代码示例。如果您正苦于以下问题:PHP User::setSurname方法的具体用法?PHP User::setSurname怎么用?PHP User::setSurname使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类AppBundle\Entity\User
的用法示例。
在下文中一共展示了User::setSurname方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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;
}
示例2: 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]);
}
示例3: createData
//.........这里部分代码省略.........
$stronieSlaskieCity = new City();
$stronieSlaskieCity->setProvince($dolnoslaskieProvince);
$stronieSlaskieCity->setActive(1);
$stronieSlaskieCity->setName('Stronie Śląskie');
$em = $this->getDoctrine()->getManager();
$em->persist($stronieSlaskieCity);
$em->flush();
$jeleniaGoraCity = new City();
$jeleniaGoraCity->setProvince($dolnoslaskieProvince);
$jeleniaGoraCity->setActive(1);
$jeleniaGoraCity->setName('Jelenia Góra');
$em = $this->getDoctrine()->getManager();
$em->persist($jeleniaGoraCity);
$em->flush();
$zmigrodCity = new City();
$zmigrodCity->setProvince($dolnoslaskieProvince);
$zmigrodCity->setActive(1);
$zmigrodCity->setName('Żmigród');
$em = $this->getDoctrine()->getManager();
$em->persist($zmigrodCity);
$em->flush();
$sobotkaCity = new City();
$sobotkaCity->setProvince($dolnoslaskieProvince);
$sobotkaCity->setActive(1);
$sobotkaCity->setName('Sobótka');
$em = $this->getDoctrine()->getManager();
$em->persist($sobotkaCity);
$em->flush();
$user = new User();
$user->setProvince($dolnoslaskieProvince);
$user->setCity($wroclawCity);
$user->setActive(1);
$user->setName('Robert');
$user->setSurname('Rybiański');
$user->setLogin('login');
$user->setPassword(md5('password'));
$user->setKey(md5(date('Y-m-d H:i:s') . 'password'));
$user->setEmail('imie@nazwisko.pl');
$user->setUrl('http://www.domena.pl/');
$user->setPhone('226666666');
$user->setStreet('Ulica 6');
$user->setPostcode('66-666');
$user->setDescription('Pierwszy użytkownik...');
$user->setCommentNumber(13);
$user->setCommentPositive7Days(2);
$user->setCommentNeutral7Days(1);
$user->setCommentNegative7Days(0);
$user->setCommentPositive30Days(3);
$user->setCommentNeutral30Days(1);
$user->setCommentNegative30Days(1);
$user->setCommentPositiveAllDays(10);
$user->setCommentNeutralAllDays(2);
$user->setCommentNegativeAllDays(1);
$user->setCommentDate($dateTime = new \DateTime('2016-03-14 16:31:09'));
$user->setIpAdded('127.0.0.1');
$user->setDateAdded($dateTime);
$user->setIpUpdated('127.0.0.1');
$user->setDateUpdated($dateTime);
$user->setIpLoged('127.0.0.1');
$user->setDateLoged($dateTime);
$em = $this->getDoctrine()->getManager();
$em->persist($user);
$em->flush();
$firm = new Firm();
$firm->setUser($user);
$firm->setProvince($dolnoslaskieProvince);
示例4: registerAction
/**
* @Route("/rejestracja")
*/
public function registerAction(Request $request)
{
$config = new Config();
$session = $request->getSession();
$cookieLogin = new CookieLogin($em = $this->getDoctrine()->getManager());
$cookieLogin->setCookieLogin($session);
$quickForm = new QuickForm($this, $request);
$email = new Email($this);
$messageString = '';
$messageClass = 'bad';
$registerForm = new RegisterForm();
$form = $this->createForm(RegisterFormType::class, $registerForm);
$form->handleRequest($request);
if ($form->isSubmitted()) {
$validator = $this->get('validator');
$errors = $validator->validate($registerForm);
if (count($errors) > 0) {
foreach ($errors as $error) {
$messageString .= $error->getMessage() . '<br />';
}
} else {
if ($this->getDoctrine()->getRepository('AppBundle:User')->isUserLogin($registerForm->getLogin())) {
$messageString .= 'Konto o podanym loginie już istnieje.<br />';
} else {
$user = new User();
$user->setProvince(NULL);
$user->setCity(NULL);
$user->setActive(0);
$user->setName($registerForm->getName());
$user->setSurname($registerForm->getSurname());
$user->setLogin($registerForm->getLogin());
$user->setPassword(md5($registerForm->getPassword()));
$user->setKey(md5(date('Y-m-d H:i:s') . $registerForm->getPassword()));
$user->setEmail($registerForm->getEmail());
$user->setUrl('');
$user->setPhone('');
$user->setStreet('');
$user->setPostcode('');
$user->setDescription('');
$user->setCommentNumber(0);
$user->setCommentPositive7Days(0);
$user->setCommentNeutral7Days(0);
$user->setCommentNegative7Days(0);
$user->setCommentPositive30Days(0);
$user->setCommentNeutral30Days(0);
$user->setCommentNegative30Days(0);
$user->setCommentPositiveAllDays(0);
$user->setCommentNeutralAllDays(0);
$user->setCommentNegativeAllDays(0);
$user->setCommentDate($dateTime = new \DateTime('now'));
$user->setIpAdded($config->getRemoteAddress());
$user->setDateAdded($dateTime);
$user->setIpUpdated('');
$user->setDateUpdated(new \DateTime('1970-01-01 00:00:00'));
$user->setIpLoged('');
$user->setDateLoged(new \DateTime('1970-01-01 00:00:00'));
$em = $this->getDoctrine()->getManager();
$em->persist($user);
$em->flush();
$messageString .= 'Konto użytkownika zostało utworzone.<br />';
$messageClass = 'ok';
if ($this->sendActivationEmail($config, $email, $registerForm, $user)) {
$messageString .= 'Sprawdź pocztę w celu aktywacji konta.<br />';
} else {
$messageString .= "Wysłanie e-mail'a aktywacyjnego nie powiodło się.<br />";
$messageClass = 'bad';
}
unset($registerForm);
unset($form);
$registerForm = new RegisterForm();
$form = $this->createForm(RegisterFormType::class, $registerForm);
}
}
}
$menu = new Menu($em, 1, 0);
return $this->render('register/register.html.twig', array('session' => $session->get('user'), 'quickForm' => $quickForm->createView(), 'form' => $form->createView(), 'messageString' => $messageString, 'messageClass' => $messageClass, 'activeCategory' => 1, 'activeProvince' => 0, 'activeCity' => 0, 'categories' => $menu->getCategories(), 'places' => $menu->getPlaces(), 'isProvince' => $menu->isProvince()));
}