Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

3.1 element full delete #3403

Merged
merged 5 commits into from
Oct 25, 2018

Conversation

narration-sd
Copy link
Contributor

@narration-sd narration-sd commented Oct 25, 2018

This is to implement changes as requested in #3392, making 3.1's Soft Delete optional.

It's implemented by selecting the new soft delete or the previous hard delete code exactly.

The choice is made simply, via a flag field added to the current ElementEvent.

The plugin in need, Live Vue, simply sets this flag when deleting its hidden Live Preview records. The process with potential flag state is protected by a try/catch/finally code path, when deletion occurs via Elements service deleteById().

Since the operation occurs in Elements::deleteElement(), it will be available for any type of element deletion. At the same time, it's defaulted so that unless an EVENT_BEFORE_DELETE_ELEMENT is taken by the using program, soft delete will always be used as expected in 3.1.

@brandonkelly brandonkelly merged commit ec6ad1f into craftcms:3.1 Oct 25, 2018
@brandonkelly
Copy link
Member

Thanks, making this an event property works for me.

$doFullDelete has been renamed to $hardDelete, and moved to a new event class, craft\events\DeleteElementEvent.

@narration-sd
Copy link
Contributor Author

Excellent, Brandon, and thanks very much.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants