本文整理汇总了PHP中AppBundle\Entity\User::setLogin方法的典型用法代码示例。如果您正苦于以下问题:PHP User::setLogin方法的具体用法?PHP User::setLogin怎么用?PHP User::setLogin使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类AppBundle\Entity\User
的用法示例。
在下文中一共展示了User::setLogin方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: retrieve
public function retrieve($login)
{
// Creating or retrieving the user
$user = $this->entityManager->getRepository("AppBundle:User")->findOneByLogin($login);
if ($user == null) {
$user = new User();
$user->setLogin($login);
}
// Updating from Intranet
$connector = new Connector();
$connector->authenticate(Connector::SIGN_IN_METHOD_CREDENTIALS, $this->connectorParameters["login"], $this->connectorParameters["password"]);
if (!$connector->isSignedIn()) {
throw new \Exception();
}
$intranetUser = new \EpitechAPI\Component\User($connector, $user->getLogin());
$user->updateFromIntranet($intranetUser);
return $user;
}
示例2: getUserOrCreateIt
protected function getUserOrCreateIt($login)
{
if (($user = $this->getContainer()->get("doctrine")->getManager()->getRepository("AppBundle:User")->findOneByLogin($login)) == null) {
$user = new User();
$user->setLogin($login);
$connector = new Connector();
$connector->authenticate(Connector::SIGN_IN_METHOD_CREDENTIALS, $this->getContainer()->getParameter("connector")["login"], $this->getContainer()->getParameter("connector")["password"]);
if ($connector->isSignedIn() == false) {
throw new \RuntimeException("Intranet is not responding");
}
$student = new \EpitechAPI\Component\User($connector, $login);
$user->updateFromIntranet($student);
$this->getContainer()->get("doctrine")->getManager()->persist($user);
$this->getContainer()->get("doctrine")->getManager()->flush();
}
return $user;
}
示例3: createData
//.........这里部分代码省略.........
$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);
$firm->setCity($wroclawCity);
示例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()));
}