Re: Core data entity creation design
Re: Core data entity creation design
- Subject: Re: Core data entity creation design
- From: Negm-Awad Amin <email@hidden>
- Date: Sun, 24 Aug 2008 18:40:39 +0200
Am So,24.08.2008 um 18:10 schrieb Quincey Morris:
On Aug 24, 2008, at 03:17, Steven Hamilton wrote:
I have a Core Data model which contains two entities. I have a
tableview with the standard bindings arrangement and Add/Remove
buttons handling one of the entities. What I need to achieve is
that when the Add button is pressed both entity types are created,
not just the one thats displayed in the table. I notice I can't use
the button to send two Add: actions so I can't do one
automatically, and the other in a custom class.
What's the best way to handle this situation? My first thought is
ditching the bindings and implementing the table datasource
methods. My next was perhaps subclassing the array controller.
Or send the button's action to First Responder, and implement the
action in (say) the window controller or document object or
application delegate. The implementation can create the new objects
directly in the data model, or send suitable messages to the array
controller that manages the table view.
Yup, that's the way to do it.
I just want to focus on two problems the TS will maybe confrantated with
- If you use the action -add: of the array controller, the object
creation will be delayed. So an immediate retrievel of the new
instance will fail. In this case it is a better solution to create the
instance on your own and use -addObject: (NSArrayController)
- if the array controller only has a context binding, but no content*
binding, he will not recognize a new instance for the entity. (if you
have y content* binding, of course, you have to add the new instance
to the to-many relationship, the array controller's content is bound
to.) This is, because there is no possibility to observe the instances
of an entity. (Do somebopdy know a hack?)
Cheers,
Amin
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden
Amin Negm-Awad
email@hidden
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden