Say I have Project and Path. Project has many paths (optional). Paths can belong to many projects (non-optional, min=1). When I archive the last Project associated to a Path, the Path should be archived, too. When the Path belongs to another active project, though, it should not be archived.
"Archival" equals setting the archivedDate property.
My naive approach is this: the persistent stack subscribes to Core Data notifications (not sure which, though), checks affected Path objects upon saving, and enforces the archival rule.
What would you do to implement "cascade" archival?
I think you could simply override
setArchivedDatein yourProjectclass. There you can check the status of all the paths and archive accordingly, something likePS: If you are using Swift, this is done in
didSet.