Hello to all. There is a form for adding a project (a project is a separate model), there are several textarea fields in it, for example, "List of sites" (a site is a separate model, the connection between a project and a site is one-to-many, that is, many sites are tied to one project ), in each such field with a new line are written lines. And then when I save the model, I assign POST data to the model, validate, and then try to save this data. And when I start saving data on sites, I get this error during validation - "mb_strlen () expects parameter 1 to be string, object given". Part of the code from the controller:
if(isset($_POST['Project'])){ $model->attributes=$_POST['Project']; if($model->validate()){ $model->save(); // преобразовываем в массив набор строк $competitors = explode(PHP_EOL,$model->competitors); foreach($competitors as $competitor){ $competitor = new Competitor(); $competitor->competitor_domen = $competitor;//$competitor - type - string $competitor->project_id = $model->id; $competitor->save();// вот здесь возникает ошибка - mb_strlen() expects parameter 1 to be string, object given }
Help to understand what is wrong and how to solve it?