I have a schema similar to the example in the book: http://book.cakephp.org/view/1034/Saving-Related-Model-Data-HABTM where Child HABTM Club through a Membership table. I'm using Child hasMany Membership, Club hasMany Membership, and Membership belongsTo Child and Club because I'm saving additional data in the Membership table.
What is the best way to delete the current memberships and save all new ones when editing a Child or Club? I really like the way cake deletes all the existing join table rows and creates new ones when you use this like a HABTM and 'unique' is set to true. Should I use a behavior (is there one out there?) or manually delete the existing rows in a beforeSave? What happens if the existing join table rows get deleted but for whatever reason the new ones don't get saved then? If you end up using a transaction to save then you have to clutter up a controller to begin and commit the transaction. I don't think that's the best but I'd like any ideas or best practices anybody can give. 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 [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
