NSOrderedSet support #504

Merged
merged 3 commits into from Jan 14, 2012

Conversation

Projects
None yet
4 participants
@bmorton
Contributor

bmorton commented Jan 13, 2012

This fixes issue #483 and adds support for NSOrderedSet in RKObjectMappingOperation. I've added a test to add coverage for the mapping, does anything need to be added to test core data or that issue more specifically?

@blakewatters

This comment has been minimized.

Show comment Hide comment
@blakewatters

blakewatters Jan 13, 2012

Owner

Great work here Brian. There should probably be an additional test serializing an NSOrderedSet to an array. That will cover the serialization use-case.

Owner

blakewatters commented Jan 13, 2012

Great work here Brian. There should probably be an additional test serializing an NSOrderedSet to an array. That will cover the serialization use-case.

@bmorton

This comment has been minimized.

Show comment Hide comment
@bmorton

bmorton Jan 14, 2012

Contributor

Good to go.

Contributor

bmorton commented Jan 14, 2012

Good to go.

blakewatters added a commit that referenced this pull request Jan 14, 2012

Merge pull request #504 from bmorton/ordered-set
Integrate support for NSOrderedSet

@blakewatters blakewatters merged commit e3264a7 into RestKit:master Jan 14, 2012

@blakewatters

This comment has been minimized.

Show comment Hide comment
@blakewatters

blakewatters Jan 14, 2012

Owner

Brian -

Thanks for the contribution! Welcome to the RestKit contributor community :-D

  • Blake
Owner

blakewatters commented Jan 14, 2012

Brian -

Thanks for the contribution! Welcome to the RestKit contributor community :-D

  • Blake
@bmorton

This comment has been minimized.

Show comment Hide comment
@bmorton

bmorton Jan 14, 2012

Contributor

Thanks! I look forward to many more :)

Contributor

bmorton commented Jan 14, 2012

Thanks! I look forward to many more :)

@f1337

This comment has been minimized.

Show comment Hide comment
@f1337

f1337 Jan 27, 2012

Contributor

NSOrderedSet is only available for iOS 5+. RestKit does not compile in my iOS 4.x projects unless I comment-out this NSOrderedSet support. How do you feel about a compiler flag around the NSOrderedSet lines?

Contributor

f1337 commented Jan 27, 2012

NSOrderedSet is only available for iOS 5+. RestKit does not compile in my iOS 4.x projects unless I comment-out this NSOrderedSet support. How do you feel about a compiler flag around the NSOrderedSet lines?

@bmorton

This comment has been minimized.

Show comment Hide comment
@bmorton

bmorton Jan 28, 2012

Contributor

Good call. I'll take a look at this today and throw something together.

Contributor

bmorton commented Jan 28, 2012

Good call. I'll take a look at this today and throw something together.

@martijnwalraven

This comment has been minimized.

Show comment Hide comment
@martijnwalraven

martijnwalraven Feb 28, 2012

Support for NSOrderedSet in applyRelationshipMappings: in RKObjectMappingOperation is still missing. This seems to work for me:

// If the relationship has changed, set it
[...]
    } else if ([destinationObject isKindOfClass:[NSOrderedSet class]]) {
        RKLogTrace(@"Mapped NSOrderedSet relationship object from keyPath '%@' to '%@'. Value: %@", relationshipMapping.sourceKeyPath, relationshipMapping.destinationKeyPath, destinationObject);
        [self.destinationObject setValue:destinationObject forKey:relationshipMapping.destinationKeyPath];
    }

We're not able to use mutableOrderedSetValueForKey: because NSMutableOrderedSet doesn't have a method like setOrderedSet: to replace the whole collection.

Support for NSOrderedSet in applyRelationshipMappings: in RKObjectMappingOperation is still missing. This seems to work for me:

// If the relationship has changed, set it
[...]
    } else if ([destinationObject isKindOfClass:[NSOrderedSet class]]) {
        RKLogTrace(@"Mapped NSOrderedSet relationship object from keyPath '%@' to '%@'. Value: %@", relationshipMapping.sourceKeyPath, relationshipMapping.destinationKeyPath, destinationObject);
        [self.destinationObject setValue:destinationObject forKey:relationshipMapping.destinationKeyPath];
    }

We're not able to use mutableOrderedSetValueForKey: because NSMutableOrderedSet doesn't have a method like setOrderedSet: to replace the whole collection.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment