php - cakephp - order by a field in the contained Model -


After

I'm trying to get all the products in which there are any special category (products haveandbelongstomany Catrgories). My terms range. Name = 'whatever' and Product.live = 1

I can do this:

  $ cats = $ this- & gt; Category & gt; Seems ('all', array ('condition' => gt; array ('category.name' = & gt; $ categoryname), 'contains' = & gt; 'product.live = 1'));  

But I also want to sort product.sort_order results, so I tried:

  $ cats = $ this-> gt; ; Category & gt; Array ('all', 'array' = '> & gt; array (' category.name '= & gt; $ categoryname),' order '=> array (' Product.sort_order '),' yes , '= & Gt;' Product.live = 1 '));  

But this does not work, what is the right way to do it?

TLR: join instead of using

my There is no overflow - it is not sure whether it is not yet in ... etc ... but - you can not order it by the model included because it usually produces multiple / different questions.


Comments

Popular posts from this blog

Member with no value in F# -

java - Joda Time Interval Not returning what I expect -

c# - Showing a SelectedItem's Property -