Reputation: 7198
Unowned one-to-many and many-to-many relationships are defined using Sets or Lists of Keys. Let's say I have an object of an article containing set of keys of labels of the article. So how do I fetch the labels themselves? The objects matching the keys? How do I iterate over them? Naturally I could iterate over the keys and fetch the objects separately, but is this the only way? I tried to find the answer everywhere but I wasn't successful. The documentation describes defining unowned relationships in detail, but is silent about making queries on them...
Upvotes: 0
Views: 499
Reputation: 15577
You mean you have what Google was originally calling an "unowned relation" ? (where you have a Set<Key>
). Sadly that is not a relation at all IMHO, since there is no related object involved. With v2.x of their plugin you can have a real unowned relation (the example there is for 1-1, but you can equally have Set<B>
) where everything looks as it should. I'd strongly advise you to use that (the keys are stored in the parent, so a single call is made to get the Set of related objects).
Upvotes: 1