diff --git a/templates/machine.m.motemplate b/templates/machine.m.motemplate index d76d64d4..709b1fcf 100644 --- a/templates/machine.m.motemplate +++ b/templates/machine.m.motemplate @@ -26,6 +26,17 @@ return (<$managedObjectClassName$>ID*)[super objectID]; } ++ (NSSet *)keyPathsForValuesAffectingValueForKey:(NSString *)key { + NSSet *keyPaths = [super keyPathsForValuesAffectingValueForKey:key]; + <$foreach Attribute noninheritedAttributes do$><$if Attribute.hasDefinedAttributeType$><$if Attribute.hasScalarAttributeType$> + if ([key isEqualToString:@"<$Attribute.name$>Value"]) { + NSSet *affectingKey = [NSSet setWithObject:@"<$Attribute.name$>"]; + keyPaths = [keyPaths setByAddingObjectsFromSet:affectingKey]; + }<$endif$><$endif$><$endforeach do$> + + return keyPaths; +} + <$foreach Attribute noninheritedAttributes do$> <$if Attribute.hasDefinedAttributeType$>