public function saveAs($model) { if (is_string($model)) { $model = $this->app->normalizeClassName($model, 'Model'); $model = $this->add($model); } $this->_save_as = $model; $res = $this->save(); $this->_save_as = null; return $res; }