I'm looking to perform some simple deletion with Core data but just need a bit of advice on this one please.
I have a model with Transaction, Name, Event and Date Entities. The Transaction has a link to each of the other Entities.
In the app, when a user adds in information to text fields, that gets saved to a 4 tab table view controller.
The first tab is using NSFetchedResultController with a fetchRequest on the Transaction Entity. The second tab is using the Name Entity, the third is using the Event and the fourth is using the Date Entity.
If I delete an entry from the Transaction tab, it deletes just that transaction which makes sense.
What I want is to be able to delete a person from the Name tab, or an event from the Event tab and have that cascading through the model of the app. So if Bob has multiple transactions, deleting him the transaction tab will delete that one transaction.
If I delete BOB from the name tab, it should deleting him from every event that he was part off with every date and Transaction.
The same applies for the events and dates.
EDIT: Update to include data model
Note: Year Entity is experimental and currently not being used How would I go about doing something like this?
Thanks
If you set the "Deletion Rule" for the "transactions" relationship from Person
to Transaction
to "Cascade", then deleting a person will automatically delete
all related transactions.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With