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


PHP CActiveRecordBehavior::afterDelete方法代碼示例

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


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

示例1: afterDelete

 /**
  * @param CEvent $event
  * @return mixed
  */
 public function afterDelete($event)
 {
     Yii::import('application.modules.comments.models.Comment');
     $pk = $this->getObjectPkAttribute();
     Comment::model()->deleteAllByAttributes(array('class_name' => $this->getClassName(), 'object_pk' => $this->getOwner()->{$pk}));
     return parent::afterDelete($event);
 }
開發者ID:kolbensky,項目名稱:rybolove,代碼行數:11,代碼來源:CommentBehavior.php

示例2: afterDelete

 public function afterDelete($event)
 {
     if (Yii::app() instanceof CWebApplication) {
         if (Yii::app()->user->getState(UserIdentity::STATE_AUDIT_TRAIL, true)) {
             UserActivityLog::model()->addRecord(array('user_id' => Yii::app()->user->id, 'ip' => Common::getIp(), 'action' => 'delete', 'activity' => $this->prepareString($this->deleteTemplate)));
         }
     }
     return parent::afterDelete($event);
 }
開發者ID:wanyos2005,項目名稱:hsbf,代碼行數:9,代碼來源:AuditTrailBehavior.php

示例3: afterDelete

 /**
  * @param CEvent $event
  * @return mixed
  */
 public function afterDelete($event)
 {
     if (Yii::app()->hasModule('comments')) {
         Yii::import('mod.comments.models.Comments');
         $pk = $this->getObjectPkAttribute();
         Comments::model()->deleteAllByAttributes(array('model' => $this->getModelName(), 'object_id' => $this->getOwner()->{$pk}));
     }
     return parent::afterDelete($event);
 }
開發者ID:buildshop,項目名稱:bs-common,代碼行數:13,代碼來源:CommentBehavior.php

示例4: afterDelete

 function afterDelete($event)
 {
     // removing all model's comments
     $comments = $this->getComments();
     foreach ($comments as $comment) {
         $comment->delete();
     }
     parent::afterDelete($event);
 }
開發者ID:ASDAFF,項目名稱:its-crm,代碼行數:9,代碼來源:ECommentable.php

示例5: afterDelete

 /**
  * Responds to {@link CActiveRecord::onBeforeDelete} event.
  * Update records order field in a manner that their values are still successively increased by one (so, there is no gap caused by the deleted record)
  * @param CEvent $event event parameter
  */
 public function afterDelete($event)
 {
     $sender = $event->sender;
     $model = call_user_func(array(get_class($sender), 'model'));
     $following_records = $model->findAll(array('order' => '`' . $this->orderField . '` ASC', 'condition' => '`' . $this->orderField . '` > ' . $sender->{$this->orderField}));
     foreach ($following_records as $record) {
         $record->{$this->orderField}--;
         $record->update();
     }
     return parent::afterDelete($event);
 }
開發者ID:buildshop,項目名稱:bs-common,代碼行數:16,代碼來源:SortableCActiveRecordBehavior.php

示例6: afterDelete

 public function afterDelete($event)
 {
     $condition = '(`firstType`=:ft AND `firstId`=:fid) OR (`secondType`=:st AND `secondId`=:sid)';
     Relationships::model()->deleteAll($condition, array(':ft' => get_class($this->owner), ':fid' => $this->owner->id, ':st' => get_class($this->owner), ':sid' => $this->owner->id));
     parent::afterDelete($event);
 }
開發者ID:dsyman2,項目名稱:X2CRM,代碼行數:6,代碼來源:RelationshipsBehavior.php

示例7: afterDelete

 /**
  * @param CEvent
  * @return void
  */
 public function afterDelete($event)
 {
     // Delete all attributes.
     $this->deleteEavAttributes(array(), TRUE);
     // Call parent method for convenience.
     parent::afterDelete($event);
 }
開發者ID:buildshop,項目名稱:bs-common,代碼行數:11,代碼來源:EEavBehavior.php

示例8: afterDelete

 /**
  * Deletes tag bindings on model delete.
  * @param CModelEvent $event
  * @return void
  */
 public function afterDelete($event)
 {
     // delete all present tag bindings
     $this->deleteTags();
     $this->cache->delete($this->getCacheKey());
     $this->resetAllTagsWithModelsCountCache();
     parent::afterDelete($event);
 }
開發者ID:balrok,項目名稱:aiajaya,代碼行數:13,代碼來源:ETaggableBehavior.php

示例9: afterDelete

 public function afterDelete($event)
 {
     if ($this->owner->contact_id && get_class($this->owner) != 'ContactLocation') {
         Address::model()->deleteAll('contact_id = :contact_id', array(':contact_id' => $this->owner->contact_id));
         Contact::model()->deleteByPk($this->owner->contact_id);
     }
     parent::afterDelete($event);
 }
開發者ID:openeyes,項目名稱:openeyes,代碼行數:8,代碼來源:ContactBehavior.php

示例10: afterDelete

 public function afterDelete($event)
 {
     try {
         $username = Yii::app()->user->Name;
         $userid = Yii::app()->user->id;
     } catch (Exception $e) {
         $username = "NO_USER";
         $userid = null;
     }
     if (empty($username)) {
         $username = "NO_USER";
     }
     if (empty($userid)) {
         $userid = null;
     }
     $log = new AuditTrail();
     $log->old_value = '';
     $log->new_value = '';
     $log->action = 'DELETE';
     $log->model = get_class($this->Owner);
     $log->model_id = $this->Owner->getPrimaryKey();
     $log->field = 'N/A';
     $log->stamp = date('Y-m-d H:i:s');
     $log->user_id = $userid;
     $log->save();
     return parent::afterDelete($event);
 }
開發者ID:romeo14,項目名稱:pow,代碼行數:27,代碼來源:LoggableBehavior.php

示例11: afterDelete

 public function afterDelete($event)
 {
     MetaTag::model()->deleteAllByAttributes(array('object_id' => $this->owner->id, 'model_id' => get_class($this->owner)));
     return parent::afterDelete($event);
 }
開發者ID:nizsheanez,項目名稱:alp.ru,代碼行數:5,代碼來源:MetaTagBehavior.php

示例12: afterDelete

 public function afterDelete($event)
 {
     parent::afterDelete($event);
     foreach ($this->fields as $field) {
         if (isset($this->owner->{$field})) {
             $img = $this->getImagePath($this->owner->{$field});
             $thumb = $this->getImagePath($this->owner->{$field}, true);
             if (file_exists($img)) {
                 unlink($img);
             }
             if (file_exists($thumb)) {
                 unlink($thumb);
             }
         }
     }
     return true;
 }
開發者ID:nurirahmat,項目名稱:Yii-Extensions,代碼行數:17,代碼來源:HasImage.php

示例13: afterDelete

 public function afterDelete($event)
 {
     $this->leaveTrail('DELETE');
     return parent::afterDelete($event);
 }
開發者ID:beckblurry,項目名稱:Yii1-Base-Core-V.Alpha.1,代碼行數:5,代碼來源:LoggableBehavior.php

示例14: afterDelete

 /**
  * @param CEvent $event
  */
 public function afterDelete($event)
 {
     $this->elasticDelete();
     parent::afterDelete($event);
 }
開發者ID:dimvic,項目名稱:yii-elastic,代碼行數:8,代碼來源:ElasticActiveRecordBehavior.php

示例15: afterDelete

 /**
  * Find changes to the model and save them as AuditField records.
  * Do not call this method directly, it will be called after the model is deleted.
  * @param CModelEvent $event
  */
 public function afterDelete($event)
 {
     if (!$this->enableAuditField) {
         parent::afterDelete($event);
         return;
     }
     $date = time();
     $auditModels = $this->getAuditModels();
     $auditRequestId = $this->getAuditRequestId();
     $userId = Yii::app()->user && Yii::app()->user->id ? Yii::app()->user->id : 0;
     $auditFields = array();
     // prepare the logs
     $pk = $this->getPrimaryKeyString($this->auditModel);
     foreach ($auditModels as $auditModel) {
         $prefix = isset($auditModel['prefix']) ? $auditModel['prefix'] . '.' . $pk : '';
         $auditFields[] = array('old_value' => '', 'new_value' => '', 'action' => 'DELETE', 'model_name' => $auditModel['model_name'], 'model_id' => $auditModel['model_id'], 'field' => $prefix . '*', 'created' => $date, 'user_id' => $userId, 'audit_request_id' => $auditRequestId);
     }
     // insert the audit_field records
     $this->addAuditFields($auditFields);
     parent::afterDelete($event);
 }
開發者ID:cornernote,項目名稱:yii-embed-wordpress,代碼行數:26,代碼來源:AuditFieldBehavior.php


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