I'm having an issue figuring out how to model/fetch items with Core Data and MagicalRecord. I have two entities, User
and Message
, which both have inverse relationships to each other:
User Entity
Relationship Destination Inverse Type
-------------------------------------------------
messages Message user To Many
Message Entity
Relationship Destination Inverse Type
-------------------------------------------------
user User messages To One
Issue
When fetching messages by a given user, MagicalRecord is returning 2x the number of records since it's matching attributes at the user
and user.messages.user
keyPaths:
- (NSArray *)fetchMessagesByUser:(NSString *)identifier {
// returning 2x the records it should
return [Message MR_findByAttribute:@"user.identifier" withValue:identifier];
}
Should I change the way I'm using MagicalRecord or is there a fundamental issue with my Core Data model?
Aucun commentaire:
Enregistrer un commentaire