當前位置: 首頁>>代碼示例>>PHP>>正文


PHP CActiveRecord::deleteByPk方法代碼示例

本文整理匯總了PHP中CActiveRecord::deleteByPk方法的典型用法代碼示例。如果您正苦於以下問題:PHP CActiveRecord::deleteByPk方法的具體用法?PHP CActiveRecord::deleteByPk怎麽用?PHP CActiveRecord::deleteByPk使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在CActiveRecord的用法示例。


在下文中一共展示了CActiveRecord::deleteByPk方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: deleteByPk

 public function deleteByPk($pk, $condition = '', $params = array())
 {
     foreach ($this->relations() as $key => $relation) {
         if ($relation[0] == self::HAS_MANY) {
             $className = $relation[1];
             $classObj = new $className();
             foreach ($classObj->model()->relations() as $keyRelation => $otherRelation) {
                 if ($otherRelation[1] == get_class($this)) {
                     if ($otherRelation[0] == self::BELONGS_TO && $otherRelation[2] == $relation[2]) {
                         foreach ($this->getRelated($key) as $obj) {
                             $obj->delete();
                         }
                     }
                     break;
                 }
             }
         }
     }
     return parent::deleteByPk($pk, $condition, $params);
 }
開發者ID:laiello,項目名稱:flexiblearning,代碼行數:20,代碼來源:Base.php

示例2: deleteByPk

 public function deleteByPk($pk, $condition = "", $params = array())
 {
     if ($this->getIsAllowCache()) {
         $ids = is_array($pk) ? $pk : explode(",", $pk);
         foreach ($ids as $id) {
             if (!empty($id)) {
                 CacheUtil::rm($this->getCacheKey($id));
             }
         }
     }
     return parent::deleteByPk($pk, $condition, $params);
 }
開發者ID:AxelPanda,項目名稱:ibos,代碼行數:12,代碼來源:ICModel.php

示例3: deleteByPk

 /**
  *
  * @param mixed $pk
  * @param string $condition
  * @param array $params
  * @return boolean 
  */
 public function deleteByPk($pk, $condition = '', $params = array())
 {
     if (CStubActiveRecord::isUnittests()) {
         return CallFactory::call($this, 'deleteByPk');
     }
     return parent::deleteByPk($pk, $condition, $params);
 }
開發者ID:anton-itscript,項目名稱:WM-Web,代碼行數:14,代碼來源:CStubActiveRecord.php


注:本文中的CActiveRecord::deleteByPk方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。