OmgDef/yii2-multilingual-behavior

Update via _ doesn't work

Opened this issue · 0 comments

Hello. Can you help me?
Idk where to search the reason but try to update fields via _ it doesn't work:
Configuration:


    public function behaviors() :array
    {
        return [
            MultilingualBehavior::class => [
                'class' => MultilingualBehavior::class,
                'languages' => [
                    'de' => 'German',
                    'fr' => 'French',
                ],

                'langClassName' => I18nLang::class,
                'langForeignKey' => 'owner_id',
                'tableName' => '{{%i18n_lang}}',
                'attributes' => [
                   'value'
                ]
            ],
        ];

rules:


    public function rules(): array
    {
        return [
            [['name', 'value', 'value_de', 'value_fr'], 'safe']
        ];
    }

So try to do like in tests:


$m = I18n::find()->multilingual()->where(['id' => $id])->one();

$m->setAttributes([
            'value_de' => 'text',
        ]);

        $m->value_de = 'text';
        $m->save();

Is empty:
image

But it works if i will do $m->value = 'text'; then it goes correct.

What I do wrong?