Skip to content

After upgrading Yii to version 2.0.14 creating new translations not working #15

@kadarpeter

Description

@kadarpeter

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions