本文整理汇总了PHP中AppBundle\Entity\User::setCity方法的典型用法代码示例。如果您正苦于以下问题:PHP User::setCity方法的具体用法?PHP User::setCity怎么用?PHP User::setCity使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类AppBundle\Entity\User
的用法示例。
在下文中一共展示了User::setCity方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: createData
//.........这里部分代码省略.........
$em = $this->getDoctrine()->getManager();
$em->persist($szczawnoZdrojCity);
$em->flush();
$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();
示例2: setCity
/**
* {@inheritDoc}
*/
public function setCity($city)
{
$this->__initializer__ && $this->__initializer__->__invoke($this, 'setCity', [$city]);
return parent::setCity($city);
}
示例3: 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()));
}
示例4: setAddress
protected function setAddress($em, $direct_cities, User $user, $hkmt)
{
//将地址写入数组
if ($_POST['area'] && $_POST['area'][0] != -1) {
$areaData = $em->getRepository('AppBundle:Area');
$add = array();
//储存省市区地址名称
foreach ($_POST['area'] as $value) {
$add[] = $areaData->find($value)->getName();
}
$add[] = $_POST['address_detail'];
//再将地址写入省市区镇,作经纬度之用
if (in_array($add[0], $direct_cities)) {
//4个直辖市、2个特别行政区和台湾
$user->setProvince($add[0]);
$user->setCity($add[0]);
if (!in_array($add[0], $hkmt)) {
$user->setDistrict($add[1]);
$user->setTown($add[2]);
} else {
$user->setDistrict($add[2]);
}
$user->setAddressDetail($add[3]);
$latlng_data = $em->getRepository('AppBundle:LatLng')->findBy(array('province' => $user->getProvince(), 'district' => $user->getDistrict()));
$this->setLatLng($latlng_data, $user);
} else {
//非直辖市
$user->setProvince($add[0]);
$user->setCity($add[1]);
if ($add[1] != "中山市") {
//非中山市
$user->setDistrict($add[2]);
$user->setTown($add[3]);
if (!empty($add[4])) {
$user->setAddressDetail($add[4]);
}
$latlng_data = $em->getRepository('AppBundle:LatLng')->findBy(array('province' => $user->getProvince(), 'city' => $user->getCity(), 'district' => $user->getDistrict()));
} else {
//是中山市
$user->setTown($add[2]);
$user->setAddressDetail($add[3]);
$latlng_data = $em->getRepository('AppBundle:LatLng')->findBy(array('province' => $user->getProvince(), 'city' => $user->getCity(), 'district' => $user->getDistrict()));
}
$this->setLatLng($latlng_data, $user);
}
}
}