I have a model - Store - with related records - StoreItem. These related records are just a mapping of a store id and an item id.
When I save a Store model, I want to delete any existing related StoreItem records, then re-add the records currently in the Store model. Is there any way to trigger that delete - or at least a custom function - when I call Store::save()?
I could use the beforeSave() event (and I will if no better solution exists), but I'd rather not delete when I don't have to. Ideally there'd be some way to mark the StoreItem records as "dirty", which would trigger a deletion before a save.