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


PHP ActiveRecord::beforeDelete方法代碼示例

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


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

示例1: beforeDelete

 public function beforeDelete()
 {
     if ($this->is_system) {
         return false;
     }
     return parent::beforeDelete();
 }
開發者ID:SimonBaeumer,項目名稱:humhub,代碼行數:7,代碼來源:ProfileFieldCategory.php

示例2: beforeDelete

 /**
  * @inheritdoc
  */
 public function beforeDelete()
 {
     if (parent::beforeDelete()) {
         FileHelper::removeDirectory(Yii::$app->file->dir . '/' . $this->id . '/');
         return true;
     }
     return false;
 }
開發者ID:sersid,項目名稱:yii2-file-upload,代碼行數:11,代碼來源:Model.php

示例3: beforeDelete

 public function beforeDelete()
 {
     foreach ($this->getUploads() as $file) {
         $file->delete();
     }
     return parent::beforeDelete();
 }
開發者ID:Vlsirko,項目名稱:yii2-uploads,代碼行數:7,代碼來源:UploadsCollection.php

示例4: beforeDelete

 public function beforeDelete()
 {
     if (!empty($this->image->id)) {
         $this->image->delete();
     }
     return parent::beforeDelete();
 }
開發者ID:bolom009,項目名稱:testwork_api,代碼行數:7,代碼來源:Category.php

示例5: beforeDelete

 public function beforeDelete()
 {
     if (file_exists($this->urlPath)) {
         unlink($this->urlPath);
     }
     return parent::beforeDelete();
 }
開發者ID:bolom009,項目名稱:testwork_api,代碼行數:7,代碼來源:Image.php

示例6: beforeDelete

 public function beforeDelete()
 {
     if (parent::beforeDelete()) {
         return unlink($this->filePath . '/' . $this->fileName);
     }
     return false;
 }
開發者ID:andreyvaslv,項目名稱:crb,代碼行數:7,代碼來源:File.php

示例7: beforeDelete

 public function beforeDelete()
 {
     foreach ($this->attachments as $attachment) {
         $attachment->delete();
     }
     return parent::beforeDelete();
 }
開發者ID:kmolchanov,項目名稱:qwintry-test,代碼行數:7,代碼來源:Document.php

示例8: beforeDelete

 public function beforeDelete()
 {
     foreach ($this->object->objectTags as $objectTag) {
         $objectTag->delete();
     }
     return parent::beforeDelete();
 }
開發者ID:app-dev-ru,項目名稱:lingnote,代碼行數:7,代碼來源:ObjectBase.php

示例9: beforeDelete

 public function beforeDelete()
 {
     if (!$this->shift->team->event->active) {
         return false;
     }
     return parent::beforeDelete();
 }
開發者ID:Flashpoint-Artists-Initiative,項目名稱:Volunteering,代碼行數:7,代碼來源:Participant.php

示例10: beforeDelete

 public function beforeDelete()
 {
     $ret = parent::beforeDelete();
     // Remove field values
     $this->getDb()->createCommand()->delete(TourFieldValue::tableName(), ['field_id' => $this->id])->execute();
     return $ret;
 }
開發者ID:phplego,項目名稱:testwork1,代碼行數:7,代碼來源:TourField.php

示例11: beforeDelete

 public function beforeDelete()
 {
     if (!parent::beforeDelete()) {
         return false;
     }
     $this->deleteFilename = $this->filename;
     return true;
 }
開發者ID:Bochozkar,項目名稱:stat.ink,代碼行數:8,代碼來源:BattleImage.php

示例12: beforeDelete

 public function beforeDelete()
 {
     if (unlink(\Yii::getAlias('@webroot') . '/' . Yii::$app->params['uploadPath'] . $this->avatar) && unlink(\Yii::getAlias('@webroot') . '/' . Yii::$app->params['uploadPreviewPath'] . $this->avatar)) {
         return parent::beforeDelete();
     } else {
         return false;
     }
 }
開發者ID:defektrain,項目名稱:sgm-rest,代碼行數:8,代碼來源:Profile.php

示例13: beforeDelete

 public function beforeDelete()
 {
     $file = $this->getImagePath() . $this->file;
     if (file_exists($file) && !is_dir($file)) {
         unlink($file);
     }
     return parent::beforeDelete();
 }
開發者ID:mops1k,項目名稱:yiimine,代碼行數:8,代碼來源:TestImage.php

示例14: beforeDelete

 public function beforeDelete()
 {
     if (parent::beforeDelete()) {
         $this->deletePreview();
         return TRUE;
     }
     return FALSE;
 }
開發者ID:xenm321,項目名稱:test,代碼行數:8,代碼來源:Books.php

示例15: beforeDelete

 public function beforeDelete()
 {
     if (!parent::beforeDelete()) {
         return false;
     }
     Settings::deleteDocument();
     return true;
 }
開發者ID:octoweb,項目名稱:yii2-settings,代碼行數:8,代碼來源:Settings.php


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