If you've constructed the relationships properly, you shouldn't be
specifying 'Resource' in your save call. You should just have this:

$this->Resource->save($this->data);

All the HABTM rows will get saved automatically. Using checkboxes in
your html you might have something like this:

<input type="checkbox" name="data[Item][Item][]" value="1"/>
<input type="checkbox" name="data[Item][Item][]" value="2"/>

This presumes you have a relational table resource_items with cols:
id, resource_id, item_id. You will need to have the proper HABTM
relationship defined in the model. Just noticed you have categories -
replace Item with Category and items with categorys (cake isn't going
to understand that categories is the plural of category).

Hope that helps,
cp

On Oct 7, 5:23 am, stefanb <[EMAIL PROTECTED]> wrote:
> What is the proper/best way to save HABTM?
>
> This is what I have:
> Resources HABTM Categories
>
> I save the Resource like this: $this->Resource->save($this-
>
> >data['Resource']);
>
> But how do I save the categories?


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to