public function delete($hard = false)
 {
     if ($hard === true) {
         return parent::delete();
     }
     return $this->saveAttributes(['updated_at' => time(), 'status' => self::STATUS_DELETED]);
 }
Example #2
0
 public function delete()
 {
     if ($this->wlabel_id != Yii::app()->user->getWhiteLabelId()) {
         return false;
     }
     return parent::delete();
 }
Example #3
0
 public function delete()
 {
     if (!$this->_hasStatus()) {
         return parent::delete();
     }
     $this->status = self::STATUS_DELETED;
     return $this->save(false);
 }
Example #4
0
 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;
 }
Example #5
0
 public function delete()
 {
     foreach ($this->Transactions as $transaction) {
         $transaction->intCorrelation = 0;
         $transaction->intType = 0;
         $transaction->save();
     }
     return parent::delete();
 }
Example #6
0
 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();
 }
Example #7
0
 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();
 }
Example #8
0
 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();
 }
Example #9
0
 /**
  * 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();
 }
 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();
         }
     }
 }
Example #11
0
 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();
 }
 /**
  * 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();
     }
 }
Example #13
0
 /**
  * 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;
 }
Example #14
0
 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();
 }
Example #15
0
 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();
 }
Example #16
0
 /**
  * Hard deletes the record.
  * @return boolean whether the deletion is successful.
  */
 public function hardDelete()
 {
     return parent::delete();
 }
 public function destroy()
 {
     // delete all conversation messages
     $msg_count = Message::model()->deleteAll('conversation_id = :cid', array(':cid' => $this->conversation_id));
     if (!$msg_count) {
         throw new Exception('Conversation messages not found?');
     }
     // delete conversation
     return parent::delete();
 }
Example #18
0
 public function delete()
 {
     parent::delete();
     // $this->onDeletePost(new Lazy8Event('User',$this->id));
     $this->dbConnection->createCommand("DELETE FROM CompanyUser WHERE userId={$this->id}")->execute();
     $this->dbConnection->createCommand("DELETE FROM Options WHERE userId={$this->id}")->execute();
     $this->dbConnection->createCommand("DELETE FROM ReportUserLastUsedParams WHERE userId={$this->id}")->execute();
     $this->dbConnection->createCommand("DELETE FROM TempTrans WHERE userId={$this->id}")->execute();
 }
Example #19
0
 public function delete()
 {
     try {
         if (!!$this->_softDelete) {
             $this->{$this->_softDelete['column']} = $this->_softDelete['value'];
             $this->update([$this->_softDelete['column']]);
         } else {
             parent::delete();
         }
     } catch (CDbException $e) {
         if ($e->errorInfo[0] == "23000") {
             Yii::app()->controller->redirect(["/site/error&id=integrity&msg=" . $e->errorInfo[2]]);
         }
     }
 }
 public function delete()
 {
     parent::delete();
     yii::app()->onDeletePost(new Lazy8Event('Donor', $this->id));
 }
Example #21
0
 public function delete()
 {
     unlink($this->getFullFilePath());
     return parent::delete();
 }
 public function delete()
 {
     //		// check permission
     //		if (!Permission::checkPermission($this, PERMISSION_ACCOUNT_TEAM_MEMBER_DELETE))
     //			return false;
     return parent::delete();
 }
 public function delete()
 {
     parent::delete();
     $rowList = TemplateRowAccount::model()->findAll('templateRowId=:templateRowId', array(':templateRowId' => $this->id));
     if ($rowList != null) {
         foreach ($rowList as $model) {
             $model->delete();
         }
     }
 }
Example #24
0
 public function delete()
 {
     foreach ($this->attrs_vals as $attr_val) {
         if ($attr_val->attr->mytype->mytype == 'photo' && !empty($attr_val->value)) {
             @unlink($_SERVER['DOCUMENT_ROOT'] . '/userfiles/original/' . $attr_val->value);
             @unlink($_SERVER['DOCUMENT_ROOT'] . '/userfiles/large/' . $attr_val->value);
             @unlink($_SERVER['DOCUMENT_ROOT'] . '/userfiles/medium/' . $attr_val->value);
             @unlink($_SERVER['DOCUMENT_ROOT'] . '/userfiles/small/' . $attr_val->value);
             break;
         }
     }
     return parent::delete();
 }
 /**
  *
  * @return boolean 
  */
 public function delete()
 {
     if (CStubActiveRecord::isUnittests()) {
         return CallFactory::call($this, 'delete');
     }
     return parent::delete();
 }
Example #26
0
 public function delete()
 {
     foreach ($this->galleryPhotos as $photo) {
         $photo->delete();
     }
     return parent::delete();
 }
Example #27
0
 public function delete()
 {
     if (!parent::delete()) {
         if (isset($this->deleted) && $this->deleted) {
             return true;
         } else {
             return false;
         }
     } else {
         return true;
     }
 }
 public function delete()
 {
     parent::delete();
     $this->dbConnection->createCommand("DELETE FROM ReportGroupFields WHERE reportGroupId={$this->id}")->execute();
 }
Example #29
0
File: Image.php Project: RSol/yupe
 public function delete()
 {
     $file = Yii::app()->getModule('image')->documentRoot . $this->file;
     if (file_exists($file)) {
         //удалить файл картинки
         if (unlink($file)) {
             return parent::delete();
         } else {
             throw new CDbException(Yii::t('image', 'При удалении файла произошла ошибка!'));
         }
     } else {
         return parent::delete();
     }
 }
Example #30
0
 public function delete()
 {
     $retval = parent::delete();
     Yii::app()->authManager->recreateAuthPathTable();
     return $retval;
 }