Hi,
I am just struggling on the same issue I think. I have a HABTM which
works fine, additional I now have a hasMany to be saved, which is no
problem if it is only a single input field. But I am actually trying
to add another.
Here is my Array:
[Recipe] => Array
(
[recipe_name] => Test
[user_id] => 1
)
[Ingredient] => Array
(
[ingredientname] => Array
(
[0] => salt
[1] => pepper
)
)
[Subcategory] => Array
(
[Subcategory] => Array
(
[0] => Maindish
)
)
Recipe HABTM Subcategory
Recipe hasMany Ingredient
Ingredient belongsTo Recipe
in my recipe_controller I use this:
$this->Recipe->create();
if ($this->Recipe->saveAll($this->data))
This way, Recipe and Subcategories get saved without a Problem, but
for Ingredient I get this:
INSERT INTO `ingredients` (`ingredientname`, `recipe_id`) VALUES
(Array, 125)
My add.ctp:
for ($counter=0;$counter<5;$counter++)
{
echo $form->input("Ingredient.0.ingredientname.
$counter",array(
'label'=> 'ingredient'));
}
What I don't understand is that the Array looks the same for
Subcategory and Ingredient, but why is it not saving on both with
them?
INSERT INTO `ingredients` (`ingredientname`) VALUES (Array)
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---