Addressing Relationships in awakeFromInsert
Addressing Relationships in awakeFromInsert
- Subject: Addressing Relationships in awakeFromInsert
- From: August Trometer <email@hidden>
- Date: Wed, 10 Aug 2005 15:01:26 -0500
I've got 2 Entities set up in a master-detail configuration. They
have inverse Relationships.
I've subclassed the Detail Entity and overridden the awakeFromInsert
method to add some default values (date added, etc.). However, when I
try to address the owner or Master via valueForKeyPath, I get a Null
return.
Here's a snippet from the Detail Entity:
- (void) awakeFromInsert
{
[super awakeFromInsert];
[self setValue:[NSDate date] forKey:@"dateCreated"]; // works fine
[self setValue:[self valueForKeyPath:@"master.createdBy"]
forKey:@"createdBy"]; // sets the value to NULL
}
I'm sure I'm missing something here -- it does seem to be the best
place for this sort of default setting -- but I can't seem to figure
out how to address the Master object. I've also tried simply
NSLogging [self valueForKeyPath:@"master"] and it, too, returns Null.
Any pointers would be appreciated.
Thanks!
August
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden