Master Data - DENY Rule Does Not Delete Destination Objects Associated with the Remote Source

I have two tables. Tasks and questions. Both tables have too many relationships between them. Delete the rule from "Tasks" in "Questions" - "DENY", and "Questions for appointments" - "Nullify".

When an assignment is deleted, I want to delete all questions related to this assignment, leaving questions that still contain links with other assignments. This is the reason the DENY removal rule is set from Assignment to Questions.

Before deleting an assignment, I make sure that I remove the link to questions from the assignment, as shown below:

Assignment *assignment = assignment to be deleted;

for (SMQuestion *question in [assignment.questions allObjects])
{
//NSLog(@"The Question ID is %@",question.questionId);

//[question removeAssignmentsObject:assignment];
[assignment removeQuestionsObject:question];
//question.assignments = nil;
}

[[[CoreDataManager sharedObject] managedObjectContext] deleteObject:assignment];

[[[CoreDataManager sharedObject] managedObjectContext] save:&error];

But after deleting a task, none of the questions are deleted from the database. Is there something I'm doing wrong here?

+1
1

DENY - . -, .

( DENY Assignment to Question) , .

. , - , .

, question.assignments = nil; , ", ".

+1

All Articles