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

DOC Update cascade_deletes information for has_many relationships #523

Merged
merged 6 commits into from
May 29, 2024

Conversation

edwilde
Copy link
Contributor

@edwilde edwilde commented May 29, 2024

Description

Given that this issue has been open for some time, we should update the documentation which is giving incorrect information to developers.

I have added an example of how best to manage cascade_deletes between many_many related objects.

To avoid adding confusion, I decided against adding the alternative solution using onBeforeDelete() and removeAll(). However this can also be added if you think it is needed, or better?

Issues

Pull request checklist

  • The target branch is correct
  • All commits are relevant to the purpose of the PR (e.g. no TODO comments, unrelated rewording/restructuring, or arbitrary changes)
    • Small amounts of additional changes are usually okay, but if it makes it hard to concentrate on the relevant changes, ask for the unrelated changes to be reverted, and submitted as a separate PR.
  • The commit messages follow our commit message guidelines
  • The PR follows our contribution guidelines
  • The changes follow our writing style guide
  • Code examples follow our coding conventions
  • CI is green

@edwilde edwilde marked this pull request as ready for review May 29, 2024 20:28
en/02_Developer_Guides/00_Model/02_Relations.md Outdated Show resolved Hide resolved
en/02_Developer_Guides/00_Model/02_Relations.md Outdated Show resolved Hide resolved
en/02_Developer_Guides/00_Model/02_Relations.md Outdated Show resolved Hide resolved
edwilde and others added 3 commits May 30, 2024 10:19
Co-authored-by: Guy Sartorelli <36352093+GuySartorelli@users.noreply.github.com>
Co-authored-by: Guy Sartorelli <36352093+GuySartorelli@users.noreply.github.com>
While it is supported, it just perhaps doesn't work the way people assume. So we need to make that clearer.
Copy link
Member

@GuySartorelli GuySartorelli left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for making those changes - just one small addition and then I'll be happy.

edwilde and others added 2 commits May 30, 2024 10:39
It can be argued that deleting _is_ also unlinking, so removing this to avoid confusion.
Co-authored-by: Guy Sartorelli <36352093+GuySartorelli@users.noreply.github.com>
Copy link
Member

@GuySartorelli GuySartorelli left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for doing this, it's a great clarification to have.

I'll merge once CI goes green (all our runners are being used right now so it might be a bit)

@edwilde
Copy link
Contributor Author

edwilde commented May 29, 2024

Thanks for the speedy turnaround @GuySartorelli 🚀

@GuySartorelli GuySartorelli merged commit 0e3245c into silverstripe:5.2 May 29, 2024
3 checks passed
@edwilde edwilde deleted the patch-3 branch May 30, 2024 00:46
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.

3 participants