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