1
cakephp 2의 saveAll() 메소드를 사용하여 많은 양의 데이터를 한 번에 저장하려고합니다. 문제는 saveAll() 함수에 전달하는 배열이 어떤 모양인지 이해할 수 없다는 것입니다. .Cakephp - saveall() - arrray는 어떻게 생겼을 까?
나는 다음과 같은 모델이 : 그래서 두 성분 각각이 recipeitems와 조리법을 저장할지 여부를
Recipe:
hasMany: Recipeitem
hasAndBelongsToMany:Category
Category:
hasAndBelongsToMany: Recipe
Recipeitem:
belongsTo: Recipe
hasMany: Ingredient
Ingredient:
belongsTo: Grocery, Recipeitem
Grocery:
hasMany: Ingredient
를, 무엇을해야 나가 시려면 보이는 기능에 전달있어 배열 객체 처럼?
이 내 배열이 순간에 모습입니다 : CakePHP의이 요리 책 읽고 지금
Array
(
[Recipe] => Array
(
[title] => Mushroom pie
[instructions] => Just mix it!
[cooking_time] => 20
)
[Category] => Array
(
[Category] => Array
(
[0] => 5
[1] => 3
)
)
[Recipeitem] => Array
(
[0] => Array
(
[Recipeitem] => Array
(
[name] => Crust
[order] => 0
[Ingredients] => Array
(
[0] => Array
(
[Ingredient] => Array
(
[amount] => 2
[unit] => dl
[order] => 0
[Grocery] => Array
(
[name] => Butter
[description] => Butter
)
)
),
[1] => Array
(
[Ingredient] => Array
(
[amount] => 3
[unit] => dl
[order] => 1
[Grocery] => Array
(
[name] => Sugar
[description] => Sugar
)
)
)
)
)
),
[1] => Array
(
[Recipeitem] => Array
(
[name] => Filling
[order] => 1
[Ingredients] => Array
(
[0] => Array
(
[Ingredient] => Array
(
[amount] => 2
[unit] => dl
[order] => 0
[Grocery] => Array
(
[name] => Mushroom
[description] => Mushroom
)
)
)
)
)
)
)
)
([나는 그것에 대해 쓴 기사] http://www.pabloleanomartinet.com/cakephp-2-x-saving-and- validating-a-habtm-relation-example /) 요 전날 .. 도움이 될만한 :) – pleasedontbelong