コード例 #1
0
 /**
  * @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);
 }
コード例 #2
0
 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);
 }
コード例 #3
0
 /**
  * @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);
 }
コード例 #4
0
ファイル: ECommentable.php プロジェクト: ASDAFF/its-crm
 function afterDelete($event)
 {
     // removing all model's comments
     $comments = $this->getComments();
     foreach ($comments as $comment) {
         $comment->delete();
     }
     parent::afterDelete($event);
 }
コード例 #5
0
 /**
  * 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);
 }
コード例 #6
0
 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);
 }
コード例 #7
0
ファイル: EEavBehavior.php プロジェクト: buildshop/bs-common
 /**
  * @param CEvent
  * @return void
  */
 public function afterDelete($event)
 {
     // Delete all attributes.
     $this->deleteEavAttributes(array(), TRUE);
     // Call parent method for convenience.
     parent::afterDelete($event);
 }
コード例 #8
0
ファイル: ETaggableBehavior.php プロジェクト: balrok/aiajaya
 /**
  * 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);
 }
コード例 #9
0
ファイル: ContactBehavior.php プロジェクト: openeyes/openeyes
 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);
 }
コード例 #10
0
ファイル: LoggableBehavior.php プロジェクト: romeo14/pow
 public function afterDelete($event)
 {
     try {
         $username = Yii::app()->user->Name;
         $userid = Yii::app()->user->id;
     } catch (Exception $e) {
         $username = "******";
         $userid = null;
     }
     if (empty($username)) {
         $username = "******";
     }
     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);
 }
コード例 #11
0
ファイル: MetaTagBehavior.php プロジェクト: nizsheanez/alp.ru
 public function afterDelete($event)
 {
     MetaTag::model()->deleteAllByAttributes(array('object_id' => $this->owner->id, 'model_id' => get_class($this->owner)));
     return parent::afterDelete($event);
 }
コード例 #12
0
 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;
 }
コード例 #13
0
 public function afterDelete($event)
 {
     $this->leaveTrail('DELETE');
     return parent::afterDelete($event);
 }
コード例 #14
0
 /**
  * @param CEvent $event
  */
 public function afterDelete($event)
 {
     $this->elasticDelete();
     parent::afterDelete($event);
 }
コード例 #15
0
 /**
  * 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);
 }
コード例 #16
0
ファイル: DataLogBehavior.php プロジェクト: GsHatRed/Yiitest
 /**
  * 删除事件处理
  * @param type $event
  */
 public function afterDelete($event)
 {
     parent::afterDelete($event);
     DataLog::model()->deleteAll(TUtil::qc('pk') . "=:pk and " . TUtil::qc('model') . "=:model", array(":pk" => $this->owner->attributes[$this->pk], ":model" => $this->owner->tableName()));
 }
コード例 #17
0
 /**
  * @param CModelEvent $event
  */
 public function afterDelete($event)
 {
     $this->clearCache();
     parent::afterDelete($event);
 }