Re: Is setting the class the same as setting a parent entity?
Re: Is setting the class the same as setting a parent entity?
- Subject: Re: Is setting the class the same as setting a parent entity?
- From: email@hidden
- Date: Sun, 15 Jan 2006 21:28:16 -0800
Just as a reply to myself, and anyone who's curious:
To link two or more object models in the same document via parent/sub
entities, in the - init method of NSPersistentDocument simply set the
sub entity from one entity in one model, to the other.
Like So:
//After calling super, NSPersistentDocument has already
automatically merged the models included in the project
NSDictionary *entities = [objectModel entitiesByName];
//Entity in one model
NSEntityDescription *mainObjectDescription = [entities
objectForKey:@"MainObjectPrototype"];
//Entity in another
NSEntityDescription *extendedObjectDescription = [entities
objectForKey:@"ExtendedObject"];
//Making main entity of the document a sub entitiy of an abstract
entity in the separate model
[extendedObjectDescription setSubentities:[NSArray arrayWithObject:
mainObjectDescription]];
If done in a non-document based app, just perform this operation in
the function that returns the managedObjectModel.
Andre
On 平成 18/01/14, at 20:58, email@hidden wrote:
Hi All,
If anyone know, is it possible to set the parent entity to one that
is located in another data model?
My NSPersistentDocument application has two, one that provides
basic reusable relationships, but are all abstract.
So i want to make concrete entities in my main model out of them,
so I'm thinking just setting the class is not enough?
Is there a chance at launch time to set the parent before loading
any docs?
Any help is greatly appreciated.
Ciao
Andre
_______________________________________________
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
_______________________________________________
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