Re: Filter a paginated dataset using a related field through a habtm relationship (1.2)

2008-09-02 Thread David C. Zentgraf
A few ideas on how I usually solve this problem: 1) Fetching a record from the database automatically gets you all the related models as well, presuming Model::$recursive is high enough. $this->Category->find("Category.id = $id") will get you an array that looks like this: array( [C

Re: Filter a paginated dataset using a related field through a habtm relationship (1.2)

2008-09-01 Thread Predominant
Hey David, I was wondering if you could drop me the SQL for your database (just the tables involved), as well as the models and the final controller code. Currently I am dealing the the same example, only with differing model names. I wanted to check with you regarding your database structure, an

Re: Filter a paginated dataset using a related field through a habtm relationship (1.2)

2008-08-21 Thread David Yell
I finally managed to get this working using a model bind. It's a bit messy and doesn't really make a whole lot of sense to me just yet. I was basically changing things and looking at the sql. For anyone looking for this type of functionality, I achieved it using this in my controller. checkRole(a

Filter a paginated dataset using a related field through a habtm relationship (1.2)

2008-08-20 Thread David Yell
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'])