protected function findModel($id) { if (($model = FieldValueVariant::findOne($id)) !== null) { return $model; } else { throw new NotFoundHttpException('The requested variant does not exist.'); } }
public static function editField($id, $name, $value) { $setting = FieldValueVariant::findOne($id); $setting->{$name} = $value; $setting->save(); }