Animal belogsTo User
Fore select option:
contoller
(if animals table has title or name)
$this->set('animals', $this->User->Animal->find('list');
view
echo $form->select('animal_id',$animals)
On Jul 25, 5:39 am, Sarah <sarah.e.p.jo...@gmail.com> wrote:
> I am not sure how to define the relationship between two tables: users
> and animals.
>
> Animals is a list of animals
> Each user in the user table has one animal
> More than one user can have the same animal
>
> I'm not sure if this is technically a hasMany relationship (since I
> suppose you could say that an animal has several users, although the
> user is not an attribute of an animal, an animal is an attribute of a
> user).
>
> In my user registration form I would like to have a select option for
> users to choose an animal (from the table).
>
> Should I define a hasMany relationship in my Animal model? If so what
> steps should I take to incorporate the animals into my user form?
--~--~---------~--~----~------------~-------~--~----~
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:
Post a Comment