$model->load problem with $_post

Good day and happy new year you all!

property:

$_POST = array(

[indent]["name"] = "title",

["discription"] = "little talk",

["ids"] = array(

[indent]

[0] = "1",

[1] = "4",

[2] = "7",

[/indent])

[/indent]

)

What i want to do:

I want to make/save the next 3 objects,

[indent]

object 1-> name = ‘title’,

object 1-> discription = ‘little talk’,

object 1 -> 1,

object 2-> name = ‘title’,

object 2-> discription = ‘little talk’,

object 2 -> 4,

object 3-> name = ‘title’,

object 3-> discription = ‘little talk’,

object 3 -> 7,

[/indent]

To do this i the $_POST will enter function

public function actionMake($id)

{

[indent] $antwoorden = new Antwoorden();

$model = $this->findModel($id);      


   OPTION 1: $antwoorden->load(Yii::$app->request->post()) ;


   OPTION 2: $antwoorden->loadMultiple($antwoorden,Yii::$app->request->post()[/indent]

Now heres the problem:

How do i make the load function understand that there are 3 objects instead of 1 with an wrong property ids because its an array instead of singe value?

PS * side thing is that $model is not of the class that i want to store -> you’ll see $antwoorden <Complex to explain but not essential for the solustion i do think>

Thaks in advance!

You need 2 separate models, one for the model you want to store and one for the form. The form model should do the input validation and if it passes, your controller can then create 3 models to store.