Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update via _ doesn't work #84

Open
sergeizhukov opened this issue Nov 8, 2019 · 0 comments
Open

Update via _ doesn't work #84

sergeizhukov opened this issue Nov 8, 2019 · 0 comments

Comments

@sergeizhukov
Copy link

sergeizhukov commented Nov 8, 2019

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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant