AHA ok got it... I understood now.

G

On Thu, Jul 2, 2009 at 12:40 PM, David Avendasora <[email protected]
> wrote:

>
> On Jul 2, 2009, at 6:26 AM, Gustavo Pizano wrote:
>
>
>
> On Thu, Jul 2, 2009 at 11:48 AM, David Avendasora <
> [email protected]> wrote:
>
>>
>> On Jul 2, 2009, at 5:19 AM, Gustavo Pizano wrote:
>>
>>  Hello.
>>>
>>> I have the following:
>>>
>>> I have a Entity called WG, and one called, TRANSLATIONSET. so the
>>> relationship is WG << >> TRANSLATIONSET.
>>>
>>> if I have the wg , I want to get all the TRANSLATIONSET that this
>>> partigual wg has. Whne I was definiyng the EOModel, I set up a manytomany
>>> relationship with a join table called WGxTS and I unchecked the Flattern
>>> box, I read it somewhere.
>>>
>>
>> If all the WGxTS table is doing is being a join table for a many-to-many
>> relationship, then flattening it I believe is the right thing to do.
>>
> mmmm I see.
>
>
>>
>>  so if I do.
>>>
>>> NSArray aux = wg.toTranslationSets();
>>>
>>
>> If you don't do flattening, then you'd need something along the lines of:
>> wg.toTranslationSets().valueForKey("TranslationSet")
>>
>
> oops.. I guess I'll have to go back to the theory,... didn'gt get why the
> valueForKey .. I guess its becuase each WGxTS has the TranslationSet_KEY and
> WG_KEY so geting the values for those kesy will create the proper swl
> command and fetch the right data.. isn't it?
>
>
> RIght. If you aren't flattening, then when you call wg.toTranslationSets()
> all you are going to get are EOs that represent the join table (they are
> valid EOs, they just don't have much "business" meaning.
>
> Since the join table EOs will have to-one relationships to TranslationSet
> and WG, then you have to call the relationship to get the actual object you
> are looking for. So, the exact syntax would be
>
> NSArray<TranslationSet> aux =
> wg.toTranslationSets().valueForKey(WGxTS.TranslationSet_KEY);
>
> Of course, if you turn flattening back on, it would simply be:
>
> NSArray<TranslationSet> aux = wg.translationSets();
>
> Much cleaner and easier to understand. Actually, if you don't turn
> flattening back on, I'd manually flatten it by writing cover methods for the
> relationships such as (on the WG entity):
>
> public NSArray<TranslationSet> translationsSets() {
> NSArray<TranslationSet> aux =
> wg.toTranslationSets().valueForKey(WGxTS.TranslationSet_KEY);
> }
>
>
> Dave
>
>
>
>
>> Dave
>>
>>  the contents of aux are all what is in the WGxTS which is not more than
>>> the pk of WG and TRANSLATIONSET related..
>>>
>>> What am I missing here, this is the first time Im working with
>>> many-to-many rs.
>>>
>>>
>>> Thanks in advance
>>>
>>> Gustavo
>>>
>>> _______________________________________________
>>> Do not post admin requests to the list. They will be ignored.
>>> Webobjects-dev mailing list      ([email protected])
>>> Help/Unsubscribe/Update your Subscription:
>>>
>>> http://lists.apple.com/mailman/options/webobjects-dev/webobjects%40avendasora.com
>>>
>>> This email sent to [email protected]
>>>
>>
>>
>
>
 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list      ([email protected])
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to [email protected]

Reply via email to