You have a bunch of
has_many RelatedItems. You might have the following seperate situations:
- Get the
RelatedItem. What happens to that
DataObject. What happens to the
Regarding 1: (in SilverStripe 3.0.x) – the
DataObjectID for that
RelatedItem is set to 0.
Regarding 2: Nothing, their
DataObjectID will point to a non-existing record.
In both cases I expected the objects to be deleted, but SilverStripe is going for safety first and keeps the records around just in case.
This means that you might need to write maintenance code if you don’t expect this happening.
Things to keep in mind
If you are writing an sync task and want to make sure RelatedItems are fresh, do not delete / remove RelatedItems before creating new ones. You will be creating thousands of records over time.
Instead, get the list of IDs, and unset the IDs that you find. Then remove any IDs left in the list as they weren’t in the source.