public function trans($id, $param = []) { $customer = Doing::findOne($id); $res = Doing::getDb()->transaction(function ($db) use($customer, $param) { $customer->email = $param['email']; $customer->save(); return $customer; }); return $res; }
/** * @return \yii\db\ActiveQuery */ public function getDoing() { return $this->hasMany(Doing::className(), ['id_name' => 'id']); }
public function actionTestDoing() { $doing = Doing::findOne(2); return $this->render('test-doing', ['doing' => $doing]); }