本文整理汇总了PHP中DAO::deleteByPrimaryKey方法的典型用法代码示例。如果您正苦于以下问题:PHP DAO::deleteByPrimaryKey方法的具体用法?PHP DAO::deleteByPrimaryKey怎么用?PHP DAO::deleteByPrimaryKey使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DAO
的用法示例。
在下文中一共展示了DAO::deleteByPrimaryKey方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: deleteByPrimaryKey
/**
* Delete by primary key, delete dependencies too
*
* @access public
* @since unknown
* @param int $id Item id
* @return bool
*/
public function deleteByPrimaryKey($id)
{
$item = $this->findByPrimaryKey($id);
if ( is_null($item) ) {
return false;
}
if( $item['b_active'] == 1 && $item['b_enabled']==1 && $item['b_spam']==0 && !osc_isExpired($item['dt_expiration'])) {
if($item['fk_i_user_id']!=null) {
User::newInstance()->decreaseNumItems($item['fk_i_user_id']);
}
CategoryStats::newInstance()->decreaseNumItems($item['fk_i_category_id']);
CountryStats::newInstance()->decreaseNumItems($item['fk_c_country_code']);
RegionStats::newInstance()->decreaseNumItems($item['fk_i_region_id']);
CityStats::newInstance()->decreaseNumItems($item['fk_i_city_id']);
}
$this->deleteResourcesFromHD($id);
$this->dao->delete(DB_TABLE_PREFIX.'t_item_description', "fk_i_item_id = $id");
$this->dao->delete(DB_TABLE_PREFIX.'t_item_comment' , "fk_i_item_id = $id");
$this->dao->delete(DB_TABLE_PREFIX.'t_item_resource', "fk_i_item_id = $id");
$this->dao->delete(DB_TABLE_PREFIX.'t_item_location', "fk_i_item_id = $id");
$this->dao->delete(DB_TABLE_PREFIX.'t_item_stats' , "fk_i_item_id = $id");
$this->dao->delete(DB_TABLE_PREFIX.'t_item_meta' , "fk_i_item_id = $id");
osc_run_hook('delete_item', $id);
$res = parent::deleteByPrimaryKey($id);
return $res;
}
示例2: deleteByPrimaryKey
/**
* Delete by primary key, delete dependencies too
*
* @access public
* @since unknown
* @param int $id Item id
* @return bool
*/
public function deleteByPrimaryKey($id)
{
osc_run_hook('delete_item', $id);
$item = $this->findByPrimaryKey($id);
if (is_null($item)) {
return false;
}
if ($item['b_active'] == 1) {
CategoryStats::newInstance()->decreaseNumItems($item['fk_i_category_id']);
}
$this->dao->delete(DB_TABLE_PREFIX . 't_item_description', "fk_i_item_id = {$id}");
$this->dao->delete(DB_TABLE_PREFIX . 't_item_comment', "fk_i_item_id = {$id}");
$this->dao->delete(DB_TABLE_PREFIX . 't_item_resource', "fk_i_item_id = {$id}");
$this->dao->delete(DB_TABLE_PREFIX . 't_item_location', "fk_i_item_id = {$id}");
$this->dao->delete(DB_TABLE_PREFIX . 't_item_stats', "fk_i_item_id = {$id}");
$this->dao->delete(DB_TABLE_PREFIX . 't_item_meta', "fk_i_item_id = {$id}");
$res = parent::deleteByPrimaryKey($id);
return $res;
}