Reputation: 2506
I have currently the following data model:
An
Entry
Object that has an attributestartDate
and an Relationship to oneMonth
ObjectA
Month
object that keeps nEntries
an has some other attributes
The month Relationship will be assigned on creation of the Entry Object depending on the startDate.
Now the following problems occurs: The user can change the start date and this can affect the month relationship. Whats the correct way to update the relationship when the startDate changes.
Is -(BOOL)validateStartDate:(id *)ioValue error:(NSError **)error
in the NSManagedObject
the right place to do this?
If yes how can I get the other months available in the current context? I think fetching objects from context in an NSManagedObject
is not a good idea
Upvotes: 0
Views: 85
Reputation: 7343
I see no other way to do it. Just fetch all the months with no predicate, figure out which one you need and set the relationship, or if you can get exactly the month you need by setting the NSFetchRequest
's predicate, it would be even better.
Upvotes: 1