Monday, August 31, 2009

Re: Self-Join with CakePHP

Well I don"t know why but I tried this with the bake console and Cake
just replace my

$conjoints = $this->Membre->Conjoint->find('list');

by my adress association

$adresses = $this->Membre->Adress->find('list');

So I wasn't able to have the both lines with the bake console..

Then, I just added it and everything is fine...

Jesus...I feel like an idiot!

On Aug 31, 2:13 pm, Martin Westin <martin.westin...@gmail.com> wrote:
> Are you sure? It looks ok to me.
> How do you check that it does not work? If you try: $this->Member->Conjoint->find('count'); that should throw a non-object warning if it
>
> does not work.
>
> Sorry, I can't suggest anything else since it does look like an ok
> association.
> /Martin
>
> On Aug 31, 1:37 pm, Bidibule <bblamp...@tagexpert.be> wrote:
>
> > Hi !
>
> > I figured an issue and I'm turning around to find the solution..
>
> > I have a Member table and each member can have one (only) other member
> > as partner.
> > So I want to make a self-join with the table Member to say that my
> > foreign key itn my member_model 'partner_id' point to another member
> > from the same table.
>
> > So I'd like to know how I can do that with cake...
>
> > Right now I have
>
> >         public $hasOne = array('Conjoint' =>
> >                                                 array('className' =>'Member',
> >                                                         'foreignKey' => 'partner_id'
>
> >                                                         )
> >         );
> >  but it doesn't work
>
> > Any idea ?
>
> > thanks you !
>
>
--~--~---------~--~----~------------~-------~--~----~
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 cake-php+unsubscribe@googlegroups.com
For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

No comments: