Re: Containable - Deep Associations - Sort resulting array

2009-08-04 Thread pomares
Yeah, I tried that, but I keep getting this error message, SQL Error: 1054: Unknown column 'AdvancementCategory.id' in 'order clause' which makes sense to me. I am trying to sort by a field that requires or taps into the special abilities of the containable behaviour, which makes it difficult to

Re: Containable - Deep Associations - Sort resulting array

2009-08-04 Thread Fran Iglesias
Hi, El 04/08/2009, a las 17:54, pomares escribió: I guess I will have to write a custom query() instead. Unless one of you comes up with a genial idea! I think you could try using joins. Read this post by Nate Abele.

Re: Containable - Deep Associations - Sort resulting array

2009-08-04 Thread pomares
Here is the custom query I ended up writing quickly. Makes for a very lean array too. :-) SELECT Client.id, Client.firstname, Client.lastname, AdvancementCategory.name, AdvancementCategory.id FROM clients as Client, families as Family, advancements as Advancement,

Re: Containable - Deep Associations - Sort resulting array

2009-08-04 Thread Jamie
Yeah, the only solutions are either to write a custom query, or use either 'ad hoc joins' as someone else mentioned, or on-the-fly binding and unbinding. I would love to see multiple JOIN clauses for these complex find operations, rather than multiple queries. We'd get less overhead and a more

Containable - Deep Associations - Sort resulting array

2009-08-03 Thread pomares
I would like a select menu filled with clients sorted by advancement category. Here are the models Client belongsTo Family Family belongsTo Advancement (i.e. status) Advancement belongsTo AdvancementCategory. My code: function clientList() { return $this-Client-find('all', array(

Re: Containable - Deep Associations - Sort resulting array

2009-08-03 Thread JamesF
function clientList() { return $this-Client-find('all', array( 'fields' = array( 'id', 'firstname', 'lastname', 'family_id'), 'contain' = array( 'Family' = array(

Re: Containable - Deep Associations - Sort resulting array

2009-08-03 Thread JamesF
On Aug 3, 4:42 pm, pomares k...@gordonpomarescentre.com wrote: I would like a select menu filled with clients sorted by advancement category. Here are the models Client belongsTo Family add an order field to your find array, not in any of the contain sub- arrays. ie