I
I
Ilya Beloborodov2017-05-31 12:02:59
Yii
Ilya Beloborodov, 2017-05-31 12:02:59

How to ignore Behavior?

there is a Game model, the behavior is declared there

'mlBehavior' => [
                'class' => MultiLanguageBehavior::className(),
                'mlConfig' => [
                    'db_table' => 'translations_with_string',
                    'attributes' => ['title', 'short', 'text', 'url', 'route'],
                    'admin_routes' => [
                        'admin/*'
                    ],
                    'clear_image_url' => 'game/items'
                ],
            ],

how to ignore the behavior with this request?
$games = Game::find()->where(['category_id' => $this->primaryKey])->with('gt')->all();

Answer the question

In order to leave comments, you need to log in

2 answer(s)
K
Kirill Arutyunov, 2017-05-31
@kowap

Do you accidentally override the find() method? In one of these behaviors, I just met this. I would look in this direction.
You can try to make two different models: with and without a behavior, inherit from the base model.
PS. I have not encountered such a task before, maybe there are standard means to untie the behavior.

A
Alexander Penshin, 2017-05-31
@apenshin

$component->detachBehavior('myBehavior1');

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question