Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Changing a value in a one-to-many on the one side will now remove sel…

…f from the inverse's many array - in my last commit, it did this only when changing to nil
  • Loading branch information...
commit 0d62ffb9545c265a9efdbeee03e90b41c1669cb8 1 parent 5508a79
Tyrone Trevorrow authored
View
2  contributed templates/Nikita Zhuk/ponso/templates/NSSet/machine.m.motemplate
@@ -182,7 +182,7 @@
<$foreach Relationship noninheritedRelationships do$><$if ! Relationship.isToMany$>
- (void) set<$Relationship.name.initialCapitalString$>: (<$Relationship.destinationEntity.managedObjectClassName$>*) <$Relationship.name$>_ settingInverse: (BOOL) setInverse
{
- <$if Relationship.inverseRelationship$><$if Relationship.inverseRelationship.isToMany$>if (<$Relationship.name$>_ == nil && setInverse == YES) {
+ <$if Relationship.inverseRelationship$><$if Relationship.inverseRelationship.isToMany$>if ((<$Relationship.name$>_ == nil || ![<$Relationship.name$>_ isEqual: <$Relationship.name$>]) && setInverse == YES) {
[<$Relationship.name$> remove<$Relationship.inverseRelationship.name.initialCapitalString$>Object: (<$managedObjectClassName$>*)self settingInverse: NO];
}<$else$>if (<$Relationship.name$>_ == nil && setInverse == YES) {
[<$Relationship.name$> set<$Relationship.inverseRelationship.name.initialCapitalString$>: nil settingInverse: NO];
View
2  contributed templates/Nikita Zhuk/ponso/templates/machine.m.motemplate
@@ -182,7 +182,7 @@
<$foreach Relationship noninheritedRelationships do$><$if ! Relationship.isToMany$>
- (void) set<$Relationship.name.initialCapitalString$>: (<$Relationship.destinationEntity.managedObjectClassName$>*) <$Relationship.name$>_ settingInverse: (BOOL) setInverse
{
- <$if Relationship.inverseRelationship$><$if Relationship.inverseRelationship.isToMany$>if (<$Relationship.name$>_ == nil) {
+ <$if Relationship.inverseRelationship$><$if Relationship.inverseRelationship.isToMany$>if ((<$Relationship.name$>_ == nil || ![<$Relationship.name$>_ isEqual: <$Relationship.name$>]) && setInverse == YES) {
[<$Relationship.name$> remove<$Relationship.inverseRelationship.name.initialCapitalString$>Object: (<$managedObjectClassName$>*)self settingInverse: NO];
}<$else$>if (<$Relationship.name$>_ == nil) {
[<$Relationship.name$> set<$Relationship.inverseRelationship.name.initialCapitalString$>: nil settingInverse: NO];
Please sign in to comment.
Something went wrong with that request. Please try again.