I have a bunch of models that are related in the following way.
(View Attached Photo it would not let me imbed it because this is my first post)
2549
My main model with the controller is Recipe_Category.
in actionCreate() I have the following:
$model=new RecipeCategory;
$recipes=new Recipes;
$recipeImages=new RecipeImages;
$recipeSteps=new RecipeSteps;
$recipeIngredients=new RecipeIngredients;
// Uncomment the following line if AJAX validation is needed
// $this->performAjaxValidation($model);
if(isset($_POST['RecipeCategory']))
{
$model->attributes=$_POST['RecipeCategory'];
$recipes->attributes=$_POST['Recipes'];
$recipeSteps->attributes=$_POST['RecipeSteps'];
$recipeImages->attributes=$_POST['RecipeImages'];
// $recipeIngredients->attributes=$_POST['RecipeIngredients'];
if($model->save())
$recipes->recipe_category = $model->recipe_category;
$recipeSteps->recipe_id = $recipes->recipe_id;
$recipeImages->recipe_id = $recipes->recipe_id;
//$recipeIngredients->recipe_id = $recipes->recipe_id;
$recipes->save();
$recipeSteps->save();
$recipeImages->save();
//$recipeIngredients->save();
$this->redirect(array('view','id'=>$model->recipe_category));
}
$this->render('create',array(
'model'=>$model,
'recipes'=>$recipes,
'recipeSteps'=>$recipeSteps,
'recipeImages'=>$recipeImages,
'recipeIngredients'=>$recipeIngredients
));
However, only Recipe_Category and Recipes will save to the database and when I display the results in the View Recipes shows "Not Set"
I’m finding Yii to be more confusing than If I did all of this with standard PHP/MySQL