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


PHP CActiveRecord::delete方法代碼示例

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


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

示例1: delete

 public function delete($hard = false)
 {
     if ($hard === true) {
         return parent::delete();
     }
     return $this->saveAttributes(['updated_at' => time(), 'status' => self::STATUS_DELETED]);
 }
開發者ID:chervand,項目名稱:yii-vk-auth,代碼行數:7,代碼來源:VkAuthActiveRecord.php

示例2: delete

 public function delete()
 {
     if ($this->wlabel_id != Yii::app()->user->getWhiteLabelId()) {
         return false;
     }
     return parent::delete();
 }
開發者ID:yasirgit,項目名稱:hotmall,代碼行數:7,代碼來源:ListingCategory.php

示例3: delete

 public function delete()
 {
     if (!$this->_hasStatus()) {
         return parent::delete();
     }
     $this->status = self::STATUS_DELETED;
     return $this->save(false);
 }
開發者ID:ZyManch,項目名稱:zbank,代碼行數:8,代碼來源:ActiveRecord.php

示例4: delete

 public function delete()
 {
     $status = parent::delete();
     $inversed = Contact::model()->findByAttributes(array('user_id' => $this->contact_id, 'contact_id' => $this->user_id));
     if ($inversed !== null) {
         $inversed->delete();
     }
     return $status;
 }
開發者ID:jayrulez,項目名稱:yiisns,代碼行數:9,代碼來源:Contact.php

示例5: delete

 public function delete()
 {
     foreach ($this->Transactions as $transaction) {
         $transaction->intCorrelation = 0;
         $transaction->intType = 0;
         $transaction->save();
     }
     return parent::delete();
 }
開發者ID:hkhateb,項目名稱:linet3,代碼行數:9,代碼來源:IntCorrelation.php

示例6: delete

 public function delete($hard = false)
 {
     // Do a soft delete if the hard delete is not forced.
     if (!$hard && $this->hasAttribute('deleted')) {
         $this->deleted = 1;
         return $this->save(false);
     }
     parent::delete();
 }
開發者ID:rBoost,項目名稱:WRUD,代碼行數:9,代碼來源:ActiveRecord.php

示例7: delete

 public function delete()
 {
     $users = User::model()->findAll();
     foreach ($users as $user) {
         $IncomeMap = UserIncomeMap::model()->findByPk(array('user_id' => $user->id, 'itemVatCat_id' => $this->id));
         if ($IncomeMap) {
             //'user_id', 'itemVatCat_id'
             $IncomeMap->delete();
         }
     }
     parent::delete();
 }
開發者ID:hkhateb,項目名稱:linet3,代碼行數:12,代碼來源:ItemVatCat.php

示例8: delete

 public function delete()
 {
     foreach ($this->Transactions as $transaction) {
         $transaction->extCorrelation = 0;
         $transaction->save();
     }
     foreach ($this->Bankbooks as $bankbook) {
         $bankbook->extCorrelation = 0;
         $bankbook->save();
     }
     return parent::delete();
 }
開發者ID:hkhateb,項目名稱:linet3,代碼行數:12,代碼來源:ExtCorrelation.php

示例9: delete

 /**
  * Update standart delete action
  */
 public function delete()
 {
     $columns = $this->tableSchema->columns;
     if (array_key_exists('active', $columns)) {
         if ($this->beforeDelete()) {
             $this->active = 0;
             $res = $this->save(false);
             $this->afterDelete();
             return $res;
         }
     }
     return parent::delete();
 }
開發者ID:arossokha,項目名稱:ex-comment,代碼行數:16,代碼來源:ActiveRecord.php

示例10: delete

 public function delete()
 {
     parent::delete();
     $this->dbConnection->createCommand("DELETE FROM ReportUserLastUsedParams WHERE reportId={$this->id}")->execute();
     $this->dbConnection->createCommand("DELETE FROM ReportParameters WHERE reportId={$this->id}")->execute();
     $this->dbConnection->createCommand("DELETE FROM ReportRows WHERE reportId={$this->id}")->execute();
     $groups = $this->groups;
     if (isset($groups) && count($groups) > 0) {
         foreach ($groups as $group) {
             $group->delete();
         }
     }
 }
開發者ID:Jride,項目名稱:accounting-thaiconnections,代碼行數:13,代碼來源:Report.php

示例11: delete

 public function delete()
 {
     /**
      * delete related records
      */
     foreach ($this->relations() as $relName => $relation) {
         if ($relation[0] != self::HAS_MANY && $relation[0] != self::HAS_ONE) {
             continue;
         }
         foreach ($this->{$relName} as $relRecord) {
             $relRecord->delete();
         }
     }
     return parent::delete();
 }
開發者ID:uldisn,項目名稱:ldm,代碼行數:15,代碼來源:BasePfOrderItems.php

示例12: processModel

 /**
  * Recursive function that deletes all children models to the $model.
  * 
  * @param CActiveRecord $model the model to process.
  * @param boolean $delete whether to delete the $model (the top model's deletion is handled by beforeDelete).
  */
 protected function processModel($model, $delete = true)
 {
     foreach ($model->relations() as $relationName => $relation) {
         $type = $relation[0];
         $className = $relation[1];
         $foreignKey = $relation[2];
         if ($type == CActiveRecord::HAS_MANY) {
             foreach ($model->{$relationName} as $subModel) {
                 if (!empty($subModel)) {
                     $this->processModel($subModel);
                 }
             }
         } elseif ($type == CActiveRecord::HAS_ONE) {
             if (!empty($model->{$relationName})) {
                 $this->processModel($model->{$relationName});
             }
         }
     }
     if ($delete) {
         $model->delete();
     }
 }
開發者ID:kostya1017,項目名稱:our,代碼行數:28,代碼來源:RecursiveDeleteBehavior.php

示例13: delete

 /**
  * besides deleting record
  * deletes its core entity as well
  *
  * @return bool|void
  */
 public function delete()
 {
     $id = $this->lb_record_primary_key;
     $coreEntity = $this->getCoreEntity();
     $result = parent::delete();
     if ($result) {
         $coreEntity->delete();
     }
     return $result;
 }
開發者ID:Lucerin,項目名稱:Yii-projects,代碼行數:16,代碼來源:CLBActiveRecord.php

示例14: delete

 public function delete()
 {
     $this->removeFile($this->galleryDir . '/' . $this->getFileName('') . '.' . $this->galleryExt);
     //create image preview for gallery manager
     $this->removeFile($this->galleryDir . '/_' . $this->getFileName('') . '.' . $this->galleryExt);
     foreach ($this->gallery->versions as $version => $actions) {
         $this->removeFile($this->galleryDir . '/' . $this->getFileName($version) . '.' . $this->galleryExt);
     }
     return parent::delete();
 }
開發者ID:kosenka,項目名稱:yboard,代碼行數:10,代碼來源:GalleryPhoto.php

示例15: delete

 public function delete()
 {
     $this->removeFile(Yii::getPathOfAlias('webroot') . '/' . $this->galleryDir . '/' . $this->getFileName('') . '.' . $this->galleryExt);
     $this->removeFile(Yii::getPathOfAlias('webroot') . '/' . $this->galleryDir . '/_' . $this->getFileName('') . '.' . $this->galleryExt);
     $this->removeImages();
     return parent::delete();
 }
開發者ID:hipogea,項目名稱:zega,代碼行數:7,代碼來源:GalleryPhoto.php


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