Changeset 210

Show
Ignore:
Timestamp:
01/24/07 13:49:34 (2 years ago)
Author:
rentzsch
Message:

[FIX] mogenerator: add recursion blocker to position_ accessor.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/cocoa/mogenerator/machine.m.motemplate

    r209 r210  
    1414<$if Attribute.name == position_$> 
    1515        //      position_ is a calculated value: @max(position_)+1. Calculate it the first time it's used. 
     16        static BOOL fetching = NO; 
    1617        if (!result || [result longLongValue] == -1) { 
     18                fetching = YES; 
    1719                NSFetchRequest *fetchObjectWithMaximumPosition = [[[NSFetchRequest alloc] init] autorelease]; 
    1820                [fetchObjectWithMaximumPosition setEntity:[self entity]]; 
     
    2325                result = [NSNumber numberWithLongLong:[objectWithMaximumPosition count] ? [[[objectWithMaximumPosition lastObject] valueForKey:@"position_"] longLongValue]+1 : 0]; 
    2426                [self setPosition_:result]; 
     27                fetching = NO; 
    2528        } 
    2629<$endif$>