Join GitHub today
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.Sign up
Unfortunately, it is currently possible to delete the referenced object without any notice or warning. This will leave the configuration in an invalid state, the validation fails from now on and - most importantly - model migrations during an upgrade will fail:
I suggest to disallow the deletion of an object if it's still referenced by a
Ok, we can solve this in our standard controller, but let's keep it "opt-in" to start with.
Add the following in your controller to use:
Which will then produce errors like this:
For reference I'll leave the path in the exception, so it should be easy to validate.