I make a call to a service, and get a result back like this:
{
main_object: {
name: "Main 1",
id: 12345,
color: "red",
items: [
{
itemName: "abcd",
itemId: "2",
},
{
itemName: "egde",
itemId: "3",
},
{
itemName: "rororo",
itemId: "4",
}
]
}
}
The service returns "main_object" (which is a managed-object) and it's list of items, which are also managed objects.
I've called "addFetchRequestBlock" for other services that I call... ones that return solely a list of items. But this one returns an object that contains a list of items. I need to persist both the object and it's list.
When I want to fetch the local items, I can just created a fetch request where "parentItem.id == 12345" in this case. And that's all good. My concern is about what happens to the orphaned objects. Not sure how to write a fetchRequestBlock that will handle nested managed objects.
Is this possible with this mechanism, or do I need to do something completely different?