Wednesday, December 31, 2008

Re: checkbox groups in cakephp 1.2

thanks for the response. thats not quite what I want. Each user can
have multiple ethnicities, so its a many to many relationship. In my
models, I have User hadMany UsersEthnicities, Ethnicity hasMany
UsersEthnicity and UsersEthnicity belongsTo User and Ethnicity. Is
this correct?

I agree with you about the sigular ids but thats the least of my
concerns right now.

On Dec 31, 1:57 am, brian <bally.z...@gmail.com> wrote:
> On Wed, Dec 31, 2008 at 12:53 AM, mike <mwu...@gmail.com> wrote:
>
> > but I need something like this right?
> >            [data] => Array
> >                (
> >                    [UsersEthnicity] => Array
> >                        (
> >                            [ethnicity_id] => 1
> >                            [users_id] => 14,
>
> >                            [ethnicity_id] => 2
> >                            [users_id] => 14
> >                        )
>
> >                    [User] => Array
> >                        (
> >                            [age] => 21
> >                            [about_me] => adfsadfs
> >                        )
>
> >                )
>
> You can't havemultipleidentical keys. But I'd think, if I'm reading
> this correctly, that you'd want Ethnicity, not the join table.
>
> [data] => Array
> (
>         [Ethnicity] => Array
>         (
>                 [0] => Array
>                 (
>                         [id] => 1
>                 ),
>                 [1] => Array
>                 (
>                         [id] => 2
>                 )
>         ),
>         [User] => Array
>         (
>                 [age] => 21
>                 [about_me] => adfsadfs
>         )
> )
>
> You're providing a choice of several ethnicities, not relationships
> between ethnicities and users, so your checkboxes should reflect
> ethnicities. If the associations are set up properly, Cake will deal
> with the join table. How do you have the model relations set up?
>
> And you'll need to include User.id, as well, I suppose.
>
> I don't that it's related (heh) but you should use the singular form
> with foreign key names, ie user_id. The idea is that, while the table
> contains many users, this user_id is unique.- Hide quoted text -
>
> - Show quoted text -
--~--~---------~--~----~------------~-------~--~----~
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: