Open jackhad opened 8 years ago
What do you define $planDetailModels in your controller?
ah..Thanks for your reply..I got the issue.
I have missed the array bracket while declaring at controller
$planDetailModels = [new PlanDetail()];
Along with this I have Question.How do we declare the same at Update()
I tried this
$model = $this->findModel($id); $planDetailModels = [new PlanDetail(['plan_id' => $id])];
but no data are populated in update form..Any idea pls?
I dont understand still
$modelCustomer = $this->findModel($id); $modelsAddress = $modelCustomer->addresses;
in update what is $modelCustomer->addresses
??
in my design plan and plan_details are join tables plan_details table plan_id is the foreign key of plan table
So how should I declare in my update() function?
You have a relation function in your plan model, it has a name like getPlandetail or another thing so in your controller you should be declare your planDetailModels like this $planDetailModels=$model->Plandetail; Note that Plandetail is getPlandetail without "get"
Wow..Thanks @yafater now populating as Expected.
many thanks :+1:
public function actionUpdate($id)
{
$modelCustomer = $this->findModel($id);
$modelsAddress = $modelCustomer->mac;
And i got Getting unknown property: common\models\Users::mac
Thank you I have also apply this code and my problem was solved. $planDetailModels = [new PlanDetail(['plan_id' => $id])];
I got this error
while implementing this