Re: Addressing Relationships in awakeFromInsert
Re: Addressing Relationships in awakeFromInsert
- Subject: Re: Addressing Relationships in awakeFromInsert
- From: mmalcolm crawford <email@hidden>
- Date: Wed, 10 Aug 2005 14:02:21 -0700
On Aug 10, 2005, at 1:31 PM, August Trometer wrote:
At no point am I setting the Master object -- this should be done
automatically. I'm assuming (maybe incorrectly?) that because of
the inverse Relationship set up between the Master and Detail
Entities that the "master" Relationship in my Detail object
automatically points back to the Master object that it's created
within.
"It is important to note that simply defining a relationship does not
cause a destination object to be created when a new source object is
created. In this respect, defining a relationship is akin to
declaring an instance variable in a standard Objective-C class.
Consider the following example.
@interface Widget : NSObject
{
Sprocket *_sprocket;
}
If you create an instance of Widget, an instance of Sprocket is not
created unless you write code to cause it to happen (for example, by
overriding the init method). Similarly, if you define an Address
entity, and a non-optional to-one relationship from Employee to
Address, then simply creating an instance of Employee does not create
a new Address instance. Likewise, if you define a non-optional to-
many relationship from Employee to Address with a minimum count of 1,
then simply creating an instance of Employee does not create a new
Address instance."
mmalc
_______________________________________________
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