Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

- Return all properties in arrays sorted by property name.

- This guarantees stable ordering on subsequent mogenerator runs.
  • Loading branch information...
commit 61450726028585633b93274269eb5c77c7b5c83e 1 parent 7d458b1
Nikita Zhuk authored
Showing with 9 additions and 6 deletions.
  1. +9 −6 mogenerator.m
15 mogenerator.m
View
@@ -74,35 +74,38 @@ - (NSString*)customSuperentity {
}
/** @TypeInfo NSAttributeDescription */
- (NSArray*)noninheritedAttributes {
+ NSArray *sortDescriptors = [NSArray arrayWithObject:[NSSortDescriptor sortDescriptorWithKey:@"name" ascending:YES]];
NSEntityDescription *superentity = [self superentity];
if (superentity) {
NSMutableArray *result = [[[[self attributesByName] allValues] mutableCopy] autorelease];
[result removeObjectsInArray:[[superentity attributesByName] allValues]];
- return result;
+ return [result sortedArrayUsingDescriptors:sortDescriptors];
} else {
- return [[self attributesByName] allValues];
+ return [[[self attributesByName] allValues] sortedArrayUsingDescriptors:sortDescriptors];
}
}
/** @TypeInfo NSAttributeDescription */
- (NSArray*)noninheritedRelationships {
+ NSArray *sortDescriptors = [NSArray arrayWithObject:[NSSortDescriptor sortDescriptorWithKey:@"name" ascending:YES]];
NSEntityDescription *superentity = [self superentity];
if (superentity) {
NSMutableArray *result = [[[[self relationshipsByName] allValues] mutableCopy] autorelease];
[result removeObjectsInArray:[[superentity relationshipsByName] allValues]];
- return result;
+ return [result sortedArrayUsingDescriptors:sortDescriptors];
} else {
- return [[self relationshipsByName] allValues];
+ return [[[self relationshipsByName] allValues] sortedArrayUsingDescriptors:sortDescriptors];
}
}
/** @TypeInfo NSFetchedPropertyDescription */
- (NSArray*)noninheritedFetchedProperties {
+ NSArray *sortDescriptors = [NSArray arrayWithObject:[NSSortDescriptor sortDescriptorWithKey:@"name" ascending:YES]];
NSEntityDescription *superentity = [self superentity];
if (superentity) {
NSMutableArray *result = [[[[self fetchedPropertiesByName] allValues] mutableCopy] autorelease];
[result removeObjectsInArray:[[superentity fetchedPropertiesByName] allValues]];
- return result;
+ return [result sortedArrayUsingDescriptors:sortDescriptors];
} else {
- return [[self fetchedPropertiesByName] allValues];
+ return [[[self fetchedPropertiesByName] allValues] sortedArrayUsingDescriptors:sortDescriptors];
}
}
Please sign in to comment.
Something went wrong with that request. Please try again.