Permalink
Browse files

Merge pull request #360 from protocool/feature/all-descriptions

[NEW] Expose an allAttributes and allRelationships accessors. [issue 328](rentzsch#328) ([Trevor Squires](rentzsch#360))
  • Loading branch information...
2 parents 9e403ad + f5fbfe9 commit db41d5845ced5e6168d8c1b261e65579e636c2e2 @rentzsch rentzsch committed on GitHub Jan 11, 2017
Showing with 11 additions and 1 deletion.
  1. +11 −1 mogenerator.m
View
@@ -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];
@@ -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];

0 comments on commit db41d58

Please sign in to comment.