HABTM association: How to populate ONLY the joining table
I have books and users table. Both tables have id field as PK, and
both have respective Book and User model and controllers.
There's a third table called books_users, this table have an id field
as PK and two FK called user_id and book_id.
There's a lot of books in the books table, and logged in user can
choice to add a book to his collection, to do this is necessary to add
a row on books_users table with choosen book's id and logged in user's
id.
Actually I do this through a function add() in the controller
BooksUsersController and relative view and model (BookUser).
There's a smarter way to do this.
Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions.
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
0 Comments:
Post a Comment
Subscribe to Post Comments [Atom]
<< Home