Permalink
Browse files

Fixed a mismatched endforeach, objects no longer set a relationship t…

…o nil on dealloc unless the relationship is non-transient, fixed one-to-one relationship inverse setters not checking the setInverse flag
  • Loading branch information...
1 parent 0d62ffb commit 11856444e044ff90a5c1a3c72b32e9b39a4811c1 @tyrone-sudeium committed Aug 21, 2011
Showing with 4 additions and 4 deletions.
  1. +4 −4 contributed templates/Nikita Zhuk/ponso/templates/machine.m.motemplate
@@ -184,10 +184,10 @@
{
<$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$>
@@ -214,8 +214,8 @@
{
<$foreach Attribute noninheritedAttributes do$><$if Attribute.hasDefinedAttributeType$>self.<$Attribute.name$> = nil;
<$endif$><$endforeach do$>
- <$foreach Relationship noninheritedRelationships do$>self.<$Relationship.name$> = nil;
- <$endforeach do$>
+ <$foreach Relationship noninheritedRelationships do$><$if ! Relationship.isTransient$>self.<$Relationship.name$> = nil;
+ <$endif$><$endforeach do$>
[super dealloc];
}

0 comments on commit 1185644

Please sign in to comment.