Re: Filtering HABTM associations using columns in both models

2006-12-20 Thread Dr. Tarique Sani
On 12/20/06, AD7six <[EMAIL PROTECTED]> wrote: On Dec 20, 12:03 pm, Tijs Teulings <[EMAIL PROTECTED]> wrote: > I might be daft but in these cases plain old SQL isn't all that bad is it... > > $posts = $this->Post->query("SELECT DISTINCT Post.title, Post.body FROM > posts as Post > LEFT JOIN

Re: Filtering HABTM associations using columns in both models

2006-12-20 Thread Tijs Teulings
ttp://irc.cakephp.org). > -- View this message in context: http://www.nabble.com/Filtering-HABTM-associations-using-columns-in-both-models-tf2699228.html#a7989908 Sent from the CakePHP mailing list archive at Nabble.com. --~--~-~--~~~---~--~~ You receive

Re: Filtering HABTM associations using columns in both models

2006-12-20 Thread AD7six
On Dec 20, 12:03 pm, Tijs Teulings <[EMAIL PROTECTED]> wrote: I might be daft but in these cases plain old SQL isn't all that bad is it... $posts = $this->Post->query("SELECT DISTINCT Post.title, Post.body FROM posts as Post LEFT JOIN posts_tags as pt ON Post.id = pt.post_id LEFT JOIN tags

Re: Filtering HABTM associations using columns in both models

2006-12-20 Thread Tijs Teulings
for info. The cake search (at the time of writing) erroneously reports less/no results for the google group. The wiki may contain incorrect info - read at your own risk (it's mainly user submitted) :) You may get your answer quicker by asking on the IRC Channel (you can access it with just

Re: Filtering HABTM associations using columns in both models

2006-12-20 Thread Jon Bennett
Hi, For a HABTM you would/could do the following: 1) Create a model for the join table. 2) bindModel a dummy hasOne association for the join table before you search 3) use a constraint that refers to the main model and the join table(not the other model) Working E.g. $this->Post->bindModel(arr

Re: Filtering HABTM associations using columns in both models

2006-12-20 Thread AD7six
On Dec 19, 12:44 pm, "Jon Bennett" <[EMAIL PROTECTED]> wrote: > Anyone has suggestions for this on? I'm having similar problems.hmm, I don't think you can with a vanilla HABTM, you need to fake it by creating a hasMany and belongsTo association with a JoinTable model, check out: http://www.thi

Re: Filtering HABTM associations using columns in both models

2006-12-19 Thread Jon Bennett
> Anyone has suggestions for this on? I'm having similar problems. hmm, I don't think you can with a vanilla HABTM, you need to fake it by creating a hasMany and belongsTo association with a JoinTable model, check out: http://www.thinkingphp.org/2006/10/26/modeling-relationships-in-cakephp-fakin

Re: Filtering HABTM associations using columns in both models

2006-12-19 Thread c1sc0
Anyone has suggestions for this on? I'm having similar problems. On Nov 24, 2:46 pm, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote: > I've seen topics that describe how to do something like find all posts > with a given tag: > > $this->Post->Tag->findAll("Tag.id = $id"); > > I'm running into a pr