Before delete all constrained foreign relations

@param bool $forced
@return bool
338821
public function beforeDelete( $forced = false )
  {
    try {

        if($this->resourcenodes){
            $this->resourcenodes->each(function($node){
                $node->delete();
            });
        }
    } catch(Execption $e) {}

    return true;
  }
66260
protected function remove($path, $force = false, $recursive = false) {
		$stat = $this->stat($path);
		$stat['realpath'] = $path;
		$this->rmTmb($stat);
		$this->clearcache();
	
		if (empty($stat)) {
			return $this->setError(elFinder::ERROR_RM, $this->_path($path), elFinder::ERROR_FILE_NOT_FOUND);
		}
	
		if (!$force && !empty($stat['locked'])) {
			return $this->setError(elFinder::ERROR_LOCKED, $this->_path($path));
		}
	
		if ($stat['mime'] == 'directory') {
			if (!$recursive && !$this->_rmdir($path)) {
				return $this->setError(elFinder::ERROR_RM, $this->_path($path));
			}
		} else {
			if (!$recursive && !$this->_unlink($path)) {
				return $this->setError(elFinder::ERROR_RM, $this->_path($path));
			}
		}
	
		$this->removed[] = $stat;
		return true;
	}
1055292
public function delete( $force = false ) {
		// If the object doesn't exist, there is nothing to delete
		// so we'll just return immediately and not do anything else.
		if ( ! $this->exists() ) {
			return;
		}

		// If the "prev_delete" filter returns false we'll bail out of the delete
		// and just return. Indicating that the delete failed.
		if ( false === apply_filters( $this->prefix( 'prev_delete' ), true ) ) {
			return;
		}

		/**
		 * Fires before a wp-object is deleted.
		 *
		 * @param static $wp_object Current object instance.
		 */
		do_action( $this->prefix( 'deleting' ), $this );

		$deleted = $this->perform_delete( $force );

		if ( $deleted ) {
			$this->clean_cache();

			// Now object will not exists.
			$this->exists = false;

			/**
			 * Fires after a WP_Object is deleted.
			 *
			 * @param int $object_id Object ID was deleted.
			 */
			do_action( $this->prefix( 'deleted' ), $this->get_id() );
		}

		return $deleted;
	}
1206477
protected function resetLang($force = false)
    {
        if ($this->autoResetLang || $force) {
            $this->lang = null;
        }

        return $this;
    }
213411
public function delete()
    {
        if ( ! is_null($this->relation))
        {
            $deleted = $this->relation->delete();

            return $deleted ? true : false;
        }

        return false;
    }
1255671
public function delete(BrandTransfer $brandTransfer): bool
    {
        $brandEntity = $this->getBrand($brandTransfer);
        $brandEntity->delete();

        return true;
    }
440964
public function deleteSubtree($withSelf = false, $forceDelete = false)
    {
        $action = ($forceDelete === true ? 'forceDelete' : 'delete');

        $ids = $this->joinClosureBy('descendant', $withSelf)->pluck($this->getKeyName());

        if ($forceDelete) {
            $this->closure->whereIn($this->closure->getDescendantColumn(), $ids)->delete();
        }

        $this->whereIn($this->getKeyName(), $ids)->$action();
    }
24877
protected function updateChanges($forceChanges = false)
    {
        if ($forceChanges) {
            // Force changes, but only for loaded fields
            foreach ($this->record as $field => $value) {
                $this->changed[$field] = static::CHANGE_VALUE;
            }
            return true;
        }
        return $this->isChanged();
    }
1207001
public function beforeDelete()
    {
        if (parent::beforeDelete()) {
            $idCardPath = $this->getIdCardPath($this->user_id);
            if (file_exists($idCardPath . '_passport_cover_image.jpg')) {
                @unlink($idCardPath . '_passport_cover_image.jpg');
            }
            if (file_exists($idCardPath . '_passport_person_page_image.jpg')) {
                @unlink($idCardPath . '_passport_person_page_image.jpg');
            }
            if (file_exists($idCardPath . '_passport_self_holding_image.jpg')) {
                @unlink($idCardPath . '_passport_self_holding_image.jpg');
            }
            return true;
        } else {
            return false;
        }
    }
34212
public static function destroy($data, $force = false)
    {
        // 包含软删除数据
        $query = self::withTrashed();

        if (is_array($data) && key($data) !== 0) {
            $query->where($data);
            $data = null;
        } elseif ($data instanceof \Closure) {
            call_user_func_array($data, [ & $query]);
            $data = null;
        } elseif (is_null($data)) {
            return false;
        }

        $resultSet = $query->select($data);

        if ($resultSet) {
            foreach ($resultSet as $data) {
                $data->force($force)->delete();
            }
        }

        return true;
    }
1116397
protected function isDeleteCascadeEmulationNeeded()
    {
        $table = $this->getTable();
        if ((!$this->getPlatform()->supportsNativeDeleteTrigger() || $this->getBuildProperty('generator.objectModel.emulateForeignKeyConstraints')) && count($table->getReferrers()) > 0) {
            foreach ($table->getReferrers() as $fk) {
                if ( ForeignKey::CASCADE === $fk->getOnDelete()) {
                    return true;
                }
            }
        }

        return false;
    }
407266
public function forceUseMaster($forceUseMaster = true)
    {
        foreach ($this->queries as $query) {
            $query->forceUseMaster($forceUseMaster);
        }

        return $this;
    }
1208423
protected function deleteModel($model, $authorize = [], $force = false)
    {
        if (is_null($model) || !$model->exists) {
            return $this->notFoundResponse();
        }

        $this->parseAuthorization($model, $authorize);

        if ($force) {
            $model->forceDelete();

            return $this->response($model, $this->trans('perma_deleted'));
        } else {
            $model->timestamps = false;
            $model->delete();
            $model->timestamps = true;

            return $this->response($model, $this->trans('deleted'));
        }
    }
859646
public function removeChild($position = null, $forceDelete = false)
    {
        if ($this->exists) {
            $action = ($forceDelete === true ? 'forceDelete' : 'delete');

            $this->children($position)->$action();
        }

        return $this;
    }
361681
public function beforeDelete()
    {
        /** @var BaseActiveRecord $owner */
        $owner = $this->owner;
        foreach ($this->_relationsCascadeDelete as $relationName => $params) {
            if ($params === true) {
                /** @var ActiveQuery $relation */
                $relation = $owner->getRelation($relationName);
                if (!empty($owner->{$relationName})) {
                    if ($relation->multiple === true) { // Has many relation
                        $this->_relationsToDelete = ArrayHelper::merge($this->_relationsToDelete, $owner->{$relationName});
                    } else {
                        $this->_relationsToDelete[] = $owner->{$relationName};
                    }
                }
            }
        }
    }
783555
private function _removeDisabledRelations()
    {
        if (!$this->attrActive) {
            return false;
        }

        foreach ($this->_relationsToSave as $key => $rel) {

            if (!isset($rel->{$this->attrActive})) {
                continue;
            }

            if (!$rel->validate() && !$rel->{$this->attrActive}) {
                ArrayHelper::remove($this->_relationsToSave, $key);
            }
        }

        return true;
    }
644724
public function beforeDelete(Model $Model, $cascade = true) {
		if ($this->settings[$Model->alias]['auto'] === false) {
			return true;
		}
		if (!$Model->ShadowModel) {
			return true;
		}
		foreach ($Model->hasAndBelongsToMany as $assocAlias => $a) {
			if (isset($Model->{$assocAlias}->ShadowModel->_schema[$Model->alias])) {
				$joins = $Model->{$a['with']}->find('all', array('recursive' => -1, 'conditions' => array($a['foreignKey'] => $Model->
							id)));
				$this->deleteUpdates[$Model->alias][$assocAlias] = Hash::extract($joins, '{n}.' . $a['with'] . '.' . $a['associationForeignKey']);
			}
		}
		return true;
	}