Actually I think I solved the problem by using the relationship keypath in the 
qualifier:

if ( cd.toOneRelationshipKeys().contains(sv1)) {
        EORelationship relation1 = entity.relationshipNamed(sv1);
        v1Qual= new EOKeyValueQualifier(relation1.relationshipPath(), 
EOQualifier.QualifierOperatorEqual, record);
}
NSArray objectsInRow = EOQualifier.filteredArrayWithQualifier(relevantObjects, 
v1Qual);

That seems to work.

Le 2 mars 2014 à 14:39, Philippe Rabier <[email protected]> a écrit :

> I don’t understand why you try to flatten a to-one relationship. You can 
> flatten an attribute or a many2many relationship.

Instead of calling classe().lycée(), I can just call lycée().
It is also useful to me because I I dynamically present the relations to the 
user for selection in a popup menu. So I need a direct relationship to Lycée.

> 
> Creating a many2many relationship is pretty straightforward: when you create 
> a relationship between 2 entities, you choose to many on both sides, give a 
> name to the join entity and check “flatten”.
> 
> Regarding your code, I don’t get you when you say “not work well with this 
> relationship”. Is it the one to try to flatten? If you have issues with the 
> relationship, it’s not surprising you don’t get the expected results, right?
> 
> Why the test "if ( cd.toOneRelationshipKeys().contains(sv1)) "? I suppose you 
> get an exception before if sv1 is not a valid relationship key…

Because I build different qualifiers if the relationship is a to-many (I didn't 
show it in the code I sent, because it is not relevant).

> 
> And I’m a bit surprised you still use accented characters (Lycée). That’s 
> something I would never play with…

You are right, but this is D2W app, and I thought it would save me writing a 
lot of displayNameForProperty rules. 

Thanks for your reply

JPM
 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list      ([email protected])
Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to [email protected]

Reply via email to