当前位置: 首页>>代码示例>>PHP>>正文


PHP DAO::deleteByPrimaryKey方法代码示例

本文整理汇总了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;
        }
开发者ID:pombredanne,项目名称:ArcherSys,代码行数:40,代码来源:Item.php

示例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;
 }
开发者ID:acharei,项目名称:OSClass,代码行数:27,代码来源:Item.php


注:本文中的DAO::deleteByPrimaryKey方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。