當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。