Does this mean that 1.2 still can't filter a result set by a related
model over habtm?

I've been trying to filter my Links by Category to no avail today.

Link habtm Category
Category habtm Link

$this->set('links', $this->paginate('Link', array('Category.id'=>$this-
>data['Link']['category_id'])));

Which fails because CakePHP won't join the related model in the query.
Will I be reduced to creating a Model for the join CategoriesLink and
then writing my own query to grab data from it? It seems determined to
do two separate queries.

The only other way I could think of, which I haven't tried yet, was to
use /category/5/$link_id which might work, but I assumed would suffer
the same fate in the sql of missing a join. Or should I be making an
on-the-fly bind using a belongsTo association to force the join, which
would then pickup my conditions?

I have read the CakeBaker article (http://cakebaker.42dh.com/
2007/10/17/pagination-of-data-from-a-habtm-relationship/), but that
looks to be for 1.1 as my existing habtm works for reading and saving,
but not for when you want to adjust the resultset using a field from
the related model.

Idea's or links would be appreciated!
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to