当前位置: 首页>>代码示例>>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;未经允许,请勿转载。