本文整理汇总了PHP中Region::NewInstance方法的典型用法代码示例。如果您正苦于以下问题:PHP Region::NewInstance方法的具体用法?PHP Region::NewInstance怎么用?PHP Region::NewInstance使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Region
的用法示例。
在下文中一共展示了Region::NewInstance方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: deleteByPrimaryKey
/**
* Delete a country with its regions, cities,..
*
* @access public
* @since 2.4
* @param $pk
* @return int number of failed deletions or 0 in case of none
*/
function deleteByPrimaryKey($pk)
{
$mRegions = Region::NewInstance();
$aRegions = $mRegions->findByCountry($pk);
$result = 0;
foreach ($aRegions as $region) {
$result += $mRegions->deleteByPrimaryKey($region['pk_i_id']);
}
Item::newInstance()->deleteByCountry($pk);
CountryStats::newInstance()->delete(array('fk_c_country_code' => $pk));
User::newInstance()->update(array('fk_c_country_code' => null, 's_country' => ''), array('fk_c_country_code' => $pk));
if (!$this->delete(array('pk_c_code' => $pk))) {
$result++;
}
return $result;
}
示例2: deleteByPrimaryKey
/**
* Delete a country with its regions, cities,..
*
* @access public
* @since 2.4
* @param $pk
* @return boolean
*/
function deleteByPrimaryKey($pk)
{
$mRegions = Region::NewInstance();
$aRegions = $mRegions->findByCountry($pk);
$mCities = City::newInstance();
$mCityAreas = CityArea::newInstance();
$result = true;
foreach ($aRegions as $region) {
$aCities = $mCities->findByRegion($region['pk_i_id']);
foreach ($aCities as $city) {
$aCityAreas = $mCityAreas->findByCity($city['pk_i_id']);
foreach ($aCityAreas as $cityArea) {
if (!$mCityAreas->delete(array('pk_i_id' => $cityArea['pk_i_id']))) {
$result = false;
}
}
if (!$mCities->delete(array('pk_i_id' => $city['pk_i_id']))) {
$result = false;
}
}
if (!$mRegions->delete(array('pk_i_id' => $region['pk_i_id']))) {
$result = false;
}
}
if (!$this->delete(array('pk_c_code' => $pk))) {
$result = false;
}
return $result;
}