I'm new to CakePHP and I want to save additional data to my HABTM join table. I've read, that one should switch to hasMany through
for this, but there is also the following note in the cake cookbook:
Changed in version 2.1.
You can set unique setting to keepExisting circumvent losing extra data during the save operation. See unique key in HABTM association arrays.
This sounds as if it is possible since 2.1. (I use the newest 2.4.2) Every question concerning this ('How to save additional data in HABTM relationships') are at least two years old. So is it possible nowadays to save additional data in HABTM join tables, e.g. ´ingredients_recipes.amount´ ("20ml of milk for whatEverRecipe")?
If so, how? As by now, the closest I got was NULL
inserted for amount
, or the amount was inserted instead of the recipes_id
.
If not, how to convert a HABTM setup to hasMany through? I'd also be thankfull for a good and uptodate tutorial, that explains how to set it all up, as I don't really get what the cookbook writes.
Thanks