Re: Core Data with NSArrayController Confusion
Re: Core Data with NSArrayController Confusion
- Subject: Re: Core Data with NSArrayController Confusion
- From: Michael Burns <email@hidden>
- Date: Tue, 8 Apr 2008 14:45:11 -0400
My only question with that is that I will need to fetch all existing
cells, and I as I understood it this was something that was not to be
done in awakeFromInsert. Is that something I dreamed up?
Thanks,
Mike
On Apr 8, 2008, at 1:20 PM, I. Savant wrote:
Adding a cell, in addition to creating a new Cell entity, also
has to do
some custom tasks on initialization. Each cell has a one-to-one
relationship with another managed object (Scene), so the scene
object needs
to be created and inserted in to the MOM when the cell is created.
This is 'business logic' that belongs in your model. Subclass
NSManagedObject for your Cell entity (remember to set the entity to
use the custom subclass in your data model) and put the
"create-my-dependent-object(s)-and-establish-relationships" logic
inside the -awakeFromInsert method.
Also, the starting location of the cell in the CellMapView is
determined by
fetching all existing cells in the context and figuring out the
first spot
that is not occupied by a previously created cell.
Same as above; determine this in -awakeFromInsert and configure
as necessary.
What gives? Is overriding "newObject" not the way to go in my
situation?
For this? Emphatically: NO.
--
I.S.
_______________________________________________
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