Re: Core Data Many2Many Relationships
Re: Core Data Many2Many Relationships
- Subject: Re: Core Data Many2Many Relationships
- From: Kent Karlsson <email@hidden>
- Date: Thu, 4 Aug 2005 11:12:12 +0200
Hi Chris,
You are thinking too much SQL when you are writing this. If you setup
a many-to-many relation between DOMAIN and EXTRA directly CoreData
will handle any link-tables without you having to bother at all with
it. You shouldn't create the DOMAINEXTRA at all.
After you've set the relation up, you can access the extras
referenced to from a domain just by accessing that relation which
will return all those elements.
-- kent
On 4 aug 2005, at 10.50, Chris Blunt wrote:
Hi,
I have a core data model set up for domains and extras, where one
domain can have several extras and one extra can belong to many
domains. I have set up an object in the middle called DomainExtra
as a link to connect the two:
+-------------+ +----------------+
+---------------+
| DOMAIN |<----------->>>| DOMAINEXTRA |<<<-------->|
EXTRA |
+-------------+ +----------------+
+---------------+
In my app, a user can set up a number of domains and a number of
extras, they will then be able to switch extras on and off for each
domain. In php/MySQL (where my DB development experience lies),
this would be fairly simple to do by inserting a domainextra record
with a relation to the domain and the extra, and then using a
SELECT statement to determine which extras existed for the domain.
However, I cannot see how to do this programmatically in core data;
I'm guessing I use some sort of searching object (predicate?) but
not sure how this would link in to any NSArrayControllers..?? I
have tried to reading the CD documentation but have had no luck.
Could anybody point me in the right direction, or towards some
documentation that describes how to achieve what I'm trying? Any
help would be greatly appreciated!!!
Thanks in advance,
Chris
--
www.chrisblunt.com
_______________________________________________
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
Attachment:
smime.p7s
Description: S/MIME cryptographic signature
_______________________________________________
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