• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: many-to-many with attributes?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: many-to-many with attributes?


  • Subject: Re: many-to-many with attributes?
  • From: Zak Burke <email@hidden>
  • Date: Tue, 26 Jul 2005 14:34:39 -0400

Jim Zajkowski wrote on 7/26/05 1:34 PM:
> Hi there,
>
> What's the best way to handle a many-to-many relationship that has an
> attribute on the relation?
[...]
> So, what's the best way to do it?  Not flatten the relation and walk
> the m-to-m by hand?

Yes. Given something like User <<-- Membership -->> Group, and assuming
you've created relations named "membership" on each of user and group,
and relations named "users" and "groups" on User and Group,
respectively, you can easily traverse the relationships like so on User:

// returns a list of the groups a user is in
public NSArray groups()
{
	return (NSArray) membership().valueForKey("groups");
}

zak.
 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

References: 
 >many-to-many with attributes? (From: Jim Zajkowski <email@hidden>)

  • Prev by Date: Re: many-to-many with attributes?
  • Next by Date: Re: many-to-many with attributes?
  • Previous by thread: Re: many-to-many with attributes?
  • Next by thread: Re: many-to-many with attributes?
  • Index(es):
    • Date
    • Thread