/*
Soft Delete the model and trigger notification for appropriate user to take action.
774872
public function softDeleteNotify( $model, $notify = true, $config = [] ) {

		if( !$model->isDeleted( true ) ) {

			$model = $this->updateStatus( $model, IApproval::STATUS_DELETED );

			if( $notify ) {

				$title = ucfirst( self::$parentType ) . ' - ' . $model->getClassName() . ' - Deleted';

				$config[ 'template' ] = CoreGlobal::TPL_NOTIFY_STATUS_DELETE;

				$this->notifyUser( $model, $config, $title );
			}

			return $model;
		}

		return false;
	}
19071
public function removeIfExpired()
    {
        if ($this->getIsExpired() && !$this->getIsNewRecord()) {
            if (($this->expiredRemovingCallback instanceof Closure || is_array($this->expiredRemovingCallback)) && is_callable($this->expiredRemovingCallback)) {
                call_user_func($this->expiredRemovingCallback, $this);
            }
            $result = $this->removeSelf();
            $this->trigger(static::$eventExpiredRemoved, new ModelEvent(['data' => ['result' => $result]]));
            return true;
        }
        return false;
    }
140154
function(model, cascade, options)
  {
    var db = this;

    // If we have it in the models, remove it!
    this.removeFromModels( model );

    // If we're offline and we have a pending save - cancel the pending save.
    if ( model.$status === Model.Status.SavePending )
    {
      Rekord.debug( Rekord.Debugs.REMOVE_CANCEL_SAVE, db, model );
    }

    model.$status = Model.Status.RemovePending;

    model.$addOperation( RemoveLocal, cascade, options );
  }
1169747
def _run_soft_delete(self):
        
        query = self.new_query().where(self.get_key_name(), self.get_key())

        time = self.fresh_timestamp()
        setattr(self, self.get_deleted_at_column(), time)

        query.update({self.get_deleted_at_column(): self.from_datetime(time)})
140686
private void _onRemoveChildResource(final ModelNode address, final ModelNode selection) {

        final ModelNode fqAddress = AddressUtils.toFqAddress(address, selection.asString());

        final ModelNode operation = new ModelNode();
        operation.get(OP).set(REMOVE);
        operation.get(ADDRESS).set(fqAddress);

        Feedback.confirm(
                "Remove Resource",
                "Do you really want to remove resource "+fqAddress.toString(),
                new Feedback.ConfirmationHandler() {
                    @Override
                    public void onConfirmation(boolean isConfirmed) {

                        if(isConfirmed) {

                            dispatcher.execute(new DMRAction(operation), new SimpleCallback<DMRResponse>() {
                                @Override
                                public void onSuccess(DMRResponse dmrResponse) {
                                    ModelNode response = dmrResponse.get();

                                    if (response.isFailure()) {
                                        Console.error("Failed to remove resource " + fqAddress.asString(), response.getFailureDescription());
                                    } else {
                                        Console.info("Successfully removed resource " + fqAddress.asString());
                                        readChildrenNames(address);
                                    }

                                }
                            });
                        }
                    }
                }
        );
    }
8681
@Override
    public void delete(final T value) {
        if (value != null) {
            final String id = value.getId();
            if (!StringUtils.isEmpty(id)) {
                doDelete(id);
                notifyDeleted(value);
            }
        }
    }
1326134
function() {
			if (this.model) {
				this.model.removeEventListener("Changing", this.listener.onModelChanging);
				this.model.removeEventListener("Changed", this.listener.onModelChanged);
				this.model.removeEventListener("Destroy", this.listener.onDestroy);
			}
			this.model = null;
			this.codeMirror = null;
			this.mode = null;
			this.lines = null;
			this.dirtyLines = null;
			clearTimeout(this.timer);
			this.timer = null;
		}
657688
public function hasSoftDeleting()
    {
        if (!$this->hasDeleting()) {
            return false;
        }

        $managedModelClass = $this->getManagedModel();

        return in_array(
            SoftDeletes::class, class_uses_recursive(get_class(new $managedModelClass()))
        ) && $this->hasDeleting();
    }
709572
function(event, model, collection, options) {
            if ((event == 'add' || event == 'remove') && collection != this) return;
            if (event == 'destroy') {
                this.remove(model, options);
            }
            this.trigger.apply(this, arguments);
        }
473148
function(model, options) {
            var index;

            if (_.isArray(model)) {
                _.each(model, function(m) {
                    this.remove(m, options);
                }, this);
                return this;
            }

            options = _.defaults(options || {}, {
                silent: false
            });

            model = this._prepareModel(model);

            _.each(this.models, function(m, i) {
                if (!m || model.id == m.id) {
                    this.models.splice(i, 1);
                    index = i;
                    return;
                }
            }, this);
            delete this._byId[model.id];

            if (options.silent) return this;
            options.index = index;
            if (this._totalCount != null) this._totalCount = _.max([0, this._totalCount - 1]);
            this.trigger('remove', model, this, options);
            this._removeReference(model);

            return this;
        }
1212649
public function forceDelete()
	{
		$softDelete = $this->softDelete;

		// We will temporarily disable false delete to allow us to perform the real
		// delete operation against the model. We will then restore the deleting
		// state to what this was prior to this given hard deleting operation.
		$this->softDelete = false;

		$this->delete();

		$this->softDelete = $softDelete;
	}
408540
function(model, options) {
      options || (options = {});
      model = this.getByCid(model) || this.get(model);
      if (!model) return null;
      delete this._byId[model.id];
      delete this._byCid[model.cid];
      this.models.splice(this.indexOf(model), 1);
      this.length--;
      if (!options.silent) model.trigger('remove', model, this, options);
      this._removeReference(model);
      return model;
    }
398247
function softDelete(callback) {
  if(this[this.primaryKey]) {
    flowsync.series([
      (next) => {
        this[symbols.callDeep]("delete", (associationDetails) => {
          return (associationDetails.type !== "belongsTo"
            && associationDetails.dependent === true);
        }, next);
      },
      (next) => {
        let now = new Datetime();
        let attributesToUpdate = {};
        attributesToUpdate[inflect("deletedAt").snake.toString()] = now.toDate();
        this[symbols.getDatabase]()
          .update(attributesToUpdate)
          .into(this.tableName)
          .where(this.primaryKey, "=", this[this.primaryKey])
          .results((error, results) => {
            if(error) {
              next(error);
            } else if (results === 0) {
              next(new Error(`${this.constructor.name} with ${this.primaryKey} ${this[this.primaryKey]} cannot be soft deleted because it doesn't exists.`));
            } else {
              next();
            }
          });
      }
    ], (errors, results) => {
      callback(errors, results);
    });
  } else {
    callback(new Error(`Cannot delete the ${this.constructor.name} because the primary key is not set.`));
  }
}
1259867
protected function softDelete()
	{
		$column = $this->model->getDeletedAtColumn();

		return $this->update(array($column => $this->model->freshTimestampString()));
	}
884811
def _on_model_delete(sender, **kwargs):
    """"""
    instance = kwargs.pop("instance")
    for index in instance.search_indexes:
        try:
            _delete_from_search_index(instance=instance, index=index)
        except Exception:
            logger.exception("Error handling 'on_delete' signal for %s", instance)
123443
public function killSoftDeletableListener()
    {
        foreach ($this->em->getEventManager()->getListeners() as $event => $listeners) {
            foreach ($listeners as $hash => $listener) {
                if ($listener instanceof SoftDeleteableListener) {
                    $listenerInst = $listener;
                    break 2;
                }
            }
        }

        $this->em->getEventManager()->removeEventListener(array('onFlush'), $listenerInst);
    }
729041
function(model, options) {
      delete this._byId[model.cid];
      var id = this.modelId(model.attributes);
      if (id != null) delete this._byId[id];
      if (this === model.collection) delete model.collection;
      model.off('all', this._onModelEvent, this);
    }