Wednesday, October 1, 2008

Re: HasAndBelongsToMany

first, by cake naming convention there shall be:
categories_forms(category_id, form_id)

After that you should read from manual chapter "Saving
hasAndBelongsToMany Relations"
form http://book.cakephp.org/view/312/Models
There is sample form markup.
You can use cake bake console to "bake" code and see how cake handle
this .


On Oct 1, 10:11 am, Copot <alexandru.co...@gmail.com> wrote:
> Hi everyone.
>
> I have the following problem (I'm using Cake 1.1).
>
> Three tables: forms, categories, forms_categories.
>
> forms (id, name)
> categories (id, name)
> forms_categories(id, id_form, id_category)
>
> Forms              hasAndBelongsToMany  Category
> Category          hasAndBelongsToMany  Form
> FormsCategory belongsTo                     Form,    Category
>
> Please help me with the code for the controller and view. I need to
> edit the form and list below the name (using a multiple select box or
> checkboxes) all the categories available for that form (and selected)
> and save the modifications.
>
> Please, please help.:D
--~--~---------~--~----~------------~-------~--~----~
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: