Permalink
Browse files

Merge branch 'master' of github.com:tyrone-sudeium/mogenerator

  • Loading branch information...
2 parents 018017b + 1185644 commit 29b5156c42a14159af9e5298a888ed77afdf1c1d @tyrone-sudeium committed Nov 28, 2011
@@ -182,12 +182,12 @@
<$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) {
+ }<$else$>if (<$Relationship.name$>_ == nil && setInverse == YES) {
[<$Relationship.name$> set<$Relationship.inverseRelationship.name.initialCapitalString$>: nil settingInverse: NO];
}
- <$endif$><$if Relationship.isTransient$><$Relationship.name$> = <$Relationship.name$>_;<$else$>if (<$Relationship.name$> != <$Relationship.name$>_) {
+ <$endif$><$endif$><$if Relationship.isTransient$><$Relationship.name$> = <$Relationship.name$>_;<$else$>if (<$Relationship.name$> != <$Relationship.name$>_) {
[<$Relationship.name$> release];
<$Relationship.name$> = [<$Relationship.name$>_ retain];
}<$endif$>
@@ -184,7 +184,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];

0 comments on commit 29b5156

Please sign in to comment.