Skip to content

Commit

Permalink
Merge pull request #360 from protocool/feature/all-descriptions
Browse files Browse the repository at this point in the history
[NEW] Expose an allAttributes and allRelationships accessors. [issue 328](#328) ([Trevor Squires](#360))
  • Loading branch information
rentzsch authored Jan 11, 2017
2 parents 9e403ad + f5fbfe9 commit db41d58
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion mogenerator.m
Original file line number Diff line number Diff line change
Expand Up @@ -201,6 +201,11 @@ - (NSString*)forcedCustomBaseClass {
return userInfoCustomBaseClass ? userInfoCustomBaseClass : gCustomBaseClassForced;
}
/** @TypeInfo NSAttributeDescription */
- (NSArray*)allAttributes {
NSArray *sortDescriptors = [NSArray arrayWithObject:[NSSortDescriptor sortDescriptorWithKey:@"name" ascending:YES]];
return [[[self attributesByName] allValues] sortedArrayUsingDescriptors:sortDescriptors];
}
/** @TypeInfo NSAttributeDescription */
- (NSArray*)noninheritedAttributes {
NSArray *sortDescriptors = [NSArray arrayWithObject:[NSSortDescriptor sortDescriptorWithKey:@"name" ascending:YES]];
NSEntityDescription *superentity = [self superentity];
Expand Down Expand Up @@ -233,7 +238,12 @@ - (NSArray*)noninheritedAttributesSansType {
}
return filteredAttributeDescriptions;
}
/** @TypeInfo NSAttributeDescription */
/** @TypeInfo NSRelationshipDescription */
- (NSArray*)allRelationships {
NSArray *sortDescriptors = [NSArray arrayWithObject:[NSSortDescriptor sortDescriptorWithKey:@"name" ascending:YES]];
return [[[self relationshipsByName] allValues] sortedArrayUsingDescriptors:sortDescriptors];
}
/** @TypeInfo NSRelationshipDescription */
- (NSArray*)noninheritedRelationships {
NSArray *sortDescriptors = [NSArray arrayWithObject:[NSSortDescriptor sortDescriptorWithKey:@"name" ascending:YES]];
NSEntityDescription *superentity = [self superentity];
Expand Down

0 comments on commit db41d58

Please sign in to comment.