Tuesday, July 28, 2009

Re: Problem with HBTM tables. (included image)

Hi Carlos

Why can't you follow the standard HABTM setup by inserting the names
of you key columns where appropriate? Something like:

class Modulo extends AppModel {
....
var $hasAndBelongsToMany = array(
'TipoUsuario' => array(
'classname' => 'TipoUsuario',
'foreignKey' => 'modulo', // The PK column in this model
'associationForeignKey' => 'tipousauario', // The PK column in the
other model
'joinTable' => 'TipoUsuarioModulo'
)
);

In your TipoUsuario model you'll have a similar HABTM definition with
the same joinTable; but the other fields replaced by their modulo
equivalents.

I hope this works for you.

Regards

David

PS I hope I've spelt all the field names correctly.


On Jul 28, 5:00 pm, Carlos Suarez Fontalvo
<eng.carlos.sua...@gmail.com> wrote:
> Hello, tnx for the ans, but, i already put the images in my questions,
> and about that, what i need is precisely that data (i need to know for
> a HABTM relationship the jointable, foreignkey, assforkey) for doing
> the rest.
>
> I apreciate your help.
>
> On Jul 27, 3:17 pm, Piotr Kilczuk <kilc...@gmail.com> wrote:
>
> > Hello,
>
> > > Excuse me, but, nobody has answer me. It's anyone here can help me?.
> > > tnx a lot.
>
> > In this case I'm pretty sure that you have to define additional HABTM
> > keys in TipoUsuario and Modulo - I mean:
> > joinTable, foreignKey, associationForeignKey. Just get one model
> > association working 1st, and then you'll get the pattern.
>
> > HTH
>
> > Regards,
> > Piotr
--~--~---------~--~----~------------~-------~--~----~
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: