public function saveContent($model, $bodyModel) { $postDatas = Yii::$app->request->post(); if ($model->load($postDatas) && $bodyModel->load($postDatas) && $model->validate() && $bodyModel->validate()) { $model->summary = $this->getSummary($model, $bodyModel); $transaction = LuLu::getDB()->beginTransaction(); try { $model->save(false); $bodyModel->content_id = $model->id; $bodyModel->save(); $transaction->commit(); return $this->redirect(['index']); } catch (\Exception $e) { $transaction->rollBack(); return false; } } return false; }