model_id = $model_id; $this->fields = json_decode(Yii::$app->cache->get(CacheId::modelFieldCacheId($model_id)),true); $this->id = $id; } function update($data) { $info = array(); $this->data = $data; foreach($data as $field=>$value) { if(!isset($this->fields[$field])) continue; $func = $this->fields[$field]['form_type']; $info[$field] = method_exists($this, $func) ? $this->$func($field, $value) : $value; } } }?>