本文整理匯總了PHP中Region::setName方法的典型用法代碼示例。如果您正苦於以下問題:PHP Region::setName方法的具體用法?PHP Region::setName怎麽用?PHP Region::setName使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Region
的用法示例。
在下文中一共展示了Region::setName方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: executeAddregion
public function executeAddregion()
{
$c = new Criteria();
$c->add(RegionPeer::NAME, $this->getRequestParameter('region'));
$exregion = RegionPeer::doSelectOne($c);
if ($exregion) {
$this->setFlash('notice', 'Region could not be added. A Region with this name already exists.');
} else {
$region = new Region();
$region->setName($this->getRequestParameter('region'));
$region->save();
$this->setFlash('notice', 'Region <b>' . $region->getName() . '</b> added successfully');
}
$this->redirect('admin/regions');
}
示例2: getRegions
public function getRegions()
{
$regions = json_decode(file_get_contents(__DIR__ . "/../Resources/regions.json"));
foreach ($regions as $region) {
$reg = new Region();
$reg->setName($region->name);
$reg->setWsId($region->id);
$reg->setType($region->type);
foreach ($region->tournaments as $tournament) {
$tour = new Tournament();
$tour->setRegion($reg);
$tour->setWsId($tournament->id);
$tour->setName($tournament->name);
$this->em->persist($tour);
}
$this->em->persist($reg);
}
$this->em->flush();
}