This repository was archived by the owner on May 20, 2021. It is now read-only.
File tree 1 file changed +4
-4
lines changed
1 file changed +4
-4
lines changed Original file line number Diff line number Diff line change @@ -279,23 +279,23 @@ - (id)objectIDForToOneRelationship:(NSRelationshipDescription *)relationship inD
279
279
return [NSNull null ];
280
280
}
281
281
282
- - (NSArray *)objectIDsForToManyRelationship : (NSRelationshipDescription *)relationship forObjectWithID : (NSManagedObjectID *)objectID {
282
+ - (id )objectIDsForToManyRelationship : (NSRelationshipDescription *)relationship forObjectWithID : (NSManagedObjectID *)objectID {
283
+ NSMutableArray *objectIDs = [[NSMutableArray alloc ] init ];
283
284
if ([self sourceDocumentStoresReferenceFieldForRelationship: relationship]) {
284
285
METDocument *document = [self documentForObjectWithID: objectID];
285
- return [self objectIDsForToManyRelationship: relationship inDocument: document];
286
+ [objectIDs addObjectsFromArray: [self objectIDsForToManyRelationship: relationship inDocument: document] ];
286
287
} else {
287
288
NSRelationshipDescription *inverseRelationship = relationship.inverseRelationship ;
288
289
NSString *sourceDocumentID = [self documentKeyForObjectID: objectID].documentID ;
289
290
NSArray *destinationDocuments = [self documentsForEntity: relationship.destinationEntity];
290
291
NSString *fieldName = [self fieldNameForRelationship: inverseRelationship];
291
- NSMutableArray *objectIDs = [[NSMutableArray alloc ] init ];
292
292
for (METDocument *document in destinationDocuments) {
293
293
if ([document[fieldName] isEqual: sourceDocumentID]) {
294
294
[objectIDs addObject: [self objectIDForDocument: document]];
295
295
}
296
296
}
297
- return objectIDs;
298
297
}
298
+ return relationship.isOrdered ? objectIDs : [NSSet setWithArray: objectIDs];
299
299
}
300
300
301
301
- (NSArray *)objectIDsForToManyRelationship : (NSRelationshipDescription *)relationship inDocument : (METDocument *)document {
You can’t perform that action at this time.
0 commit comments