On 28/05/12 14:41, Benjamin Allison wrote:
> Oh. Well I had a HABTM setup originally, but I need to store
> additional information with the associations – so not just user_id and
> survey_id, but additional fields (date_assigned, survey_priority). As
> far as I know, you're not allowed to add columns to the HABTM join table.
>
You can have extra fields with no problem at all. If you look at the
models, both your user and survey model will have the join table
(users_surveys) defined with the key that it is joined on.
All you will have to do is generate a model for users_surveys too so
that you can extract the extra data and provide queries to use both
user_id and survey_id instead of the id field of the join table.
Basically, it is quite straightforward to do this, but Cake will not
generate all the code for you.
--
Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org
Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions.
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
Monday, May 28, 2012
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment