A
A
AlexKuznec2017-01-26 14:24:17
Yii
AlexKuznec, 2017-01-26 14:24:17

Yii2 console controller conflict with ContentNegotiator?

I declared in common\config\main.php an autoloaded user language specifier:

'bootstrap' => [
        'ContentNegotiator' => [
            'class' => 'yii\filters\ContentNegotiator',
            'languages' => [
                'en',
                'ru',
                'de',
            ],
        ],
    ],

However, when I try to execute any yii console command (the same file generator with translations), I get an error with a link to this element.
It is clear that it can take information only from the browser, and to fix the error, you can declare it twice in the frontend and backend (which you really don’t want to do).
It's embarrassing that I googled and found no such complaints... Am I doing something wrong?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Abdula Magomedov, 2017-01-26
@AlexKuznec

Move the configuration from the general configuration to the frontend configuration, in the file frontend/config/main.php

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question