Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

Archive /

Our old forums are still available as a read-only archive.

Moderators: martimiz, Sean, biapar, Willr, Ingo, simon_w

Sorting within a many_many-relation


Reply


2 Posts   2373 Views

Avatar
Steven

Community Member, 6 Posts

6 February 2008 at 4:49am

Hi there,

I probably have got a really novice question, but I wasn't able to find anything about that:

How can I sort the output of a n:n-relation? I my specific case I've got a catalog, including categories and products. Each product can be assigned to multiple categories.

It is no problem to sort a 1:n-relation via DataObject::get(...). But using the n:n-relation, there is one more table to manage and I don't know, how to include it into my query.

Steven

Avatar
Steven

Community Member, 6 Posts

6 February 2008 at 11:12pm

ok, I fixed it by redeclaring the JOIN-Term.
I was trying to (re)use that JOIN, silverstripe is extracting out of the relation-definition.

Steven