本文整理匯總了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;
}