private function save() { $model = new RuleModel(['name' => $this->name, 'datatype' => $this->datatype]); $model->save(); $this->dbid = $model->id; $this->model = $model; $this->condition->save($model, $model, 0); for ($i = 0; $i < count($this->actions); $i++) { $this->actions[$i]->save($model, $model, $i); } }