Before Yii version 2.0.14, the following code works well:
class PostController extends Controller
{
public function actionCreate()
{
$model = new Post();
foreach (Yii::$app->request->post('PostTranslation', []) as $language => $data) {
foreach ($data as $attribute => $translation) {
$model->translate($language)->$attribute = $translation;
}
}
//...
}
After upgrading Yii to version 2.0.14, the above code does not working. The related records in the post_translation table are not created. If I update the newly created post record, the translations are created in the post_translation table.