Re: Binding to to-one relationship
Re: Binding to to-one relationship
- Subject: Re: Binding to to-one relationship
- From: Matt Neuburg <email@hidden>
- Date: Fri, 06 Jan 2006 10:11:22 -0800
- Thread-topic: Binding to to-one relationship
On Thu, 5 Jan 2006 21:44:41 -0500, Jeff LaMarche <email@hidden>
said:
>Okay, I've got an entity with a to-one relationship to another
>entity. So, for example, I have a Person entity with a to-one
>relationship called primaryPhone to a PhoneNumber entity. The Person
>entities are being managed by an array controller and I'm currently
>connecting buttons directly to the array controller's add: action to
>create new Person entities. I want to display the phone number fields
>right along with the other fields from the selected Person entity
>using a keypath primaryPhone.number for example.
>
>Only problem is, the PhoneNumber entity is never getting created, so
>any values entered into the phone number fields aren't going
>anywhere. Is there a way to have it automatically create the
>PhoneNumber entity when the array controller inserts a new Person
>entity, or do I have to use a custom method for adding objects and
>manually creates the PhoneNumber entity and sticks it in the to-one
>relationship?
Not quite sure what "it" is in that sentence, but it sounds like you want to
override awakeFromInsert (this is, in effect, the "designated initializer").
m.
--
matt neuburg, phd = email@hidden, <http://www.tidbits.com/matt/>
A fool + a tool + an autorelease pool = cool!
AppleScript: the Definitive Guide
<http://www.amazon.com/exec/obidos/ASIN/0596005571/somethingsbymatt>
_______________________________________________
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