Re: Self Join query

2009-09-29 Thread Bert Van den Brande
Oops clicked 'send' by accident. So what I meant was : Hah it works ? Great :) Yes Containable Behavior is a very important one. Start using it on all your model from the start of your project , it will save you a lot of queries and refactoring of code afterwards. Glad I could help, Bert On T

Re: Self Join query

2009-09-29 Thread Bert Van den Brande
Ha On Tue, Sep 29, 2009 at 12:44 PM, hunny wrote: > > Thanks Bert, > > It works perfectly fine. This is exactly what I was looking for. > While going through the manual, I had completely left the Behaviors > Section. I think its high time that I go through it. > > > On Sep 28, 4:53 pm, Bert Van

Re: Self Join query

2009-09-29 Thread hunny
Thanks Bert, It works perfectly fine. This is exactly what I was looking for. While going through the manual, I had completely left the Behaviors Section. I think its high time that I go through it. On Sep 28, 4:53 pm, Bert Van den Brande wrote: > I typed this code out of the top of my head, b

Re: Self Join query

2009-09-28 Thread Bert Van den Brande
I typed this code out of the top of my head, but it might be worth a try : $this->User->Behaviors->attach('Containable'); $this->User->bindModel(array( 'hasOne' => array( // Model linking type is 'hasOne', this forces Cake to make joins 'UserB' => array(

Re: Self Join query

2009-09-28 Thread Bert Van den Brande
I would use the Containable behavior here, combined with a custom binding that you attach on the fly. Have no idea however how exactly to expres a self-join binding ... try and play around with it :) On Mon, Sep 28, 2009 at 12:04 PM, hunny wrote: > > > > On Sep 28, 2:19 pm, Aivaras wrote: > >

Re: Self Join query

2009-09-28 Thread hunny
On Sep 28, 2:19 pm, Aivaras wrote: > Hey, take a look at > this:http://voveris.eu/2009/09/05/left-join-with-cakephp/I am sure you find > this > handy. > > On Mon, Sep 28, 2009 at 12:04, hunny wrote: > > > Hi All, > > > I am new to cakephp. I would like to execute the following SELF Join > >

Re: Self Join query

2009-09-28 Thread Aivaras
Hey, take a look at this: http://voveris.eu/2009/09/05/left-join-with-cakephp/ I am sure you find this handy. On Mon, Sep 28, 2009 at 12:04, hunny wrote: > > Hi All, > > I am new to cakephp. I would like to execute the following SELF Join > query. > > SELECT B.* FROM `users` AS A LEFT JOIN `use