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 str
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,
advancement_ca
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.
http://bakery.cakephp.org/articles/view/quick-tip-doing-ad-hoc-joins-in-m
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 t
On Aug 3, 4:42 pm, pomares 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
'order'=>'AdvancementCategory.id ASC'
you also ad
function clientList() {
return $this->Client->find('all', array(
'fields' =>
array(
'id',
'firstname',
'lastname',
'family_id'),
'contain' =>
array(
'Family' => array(
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(