D
D
Dilik Pulatov2017-06-24 16:00:33
Yii
Dilik Pulatov, 2017-06-24 16:00:33

Why in Yii2 two beforeAction() doesn't work?

Hello!
for example, I have one main controller AppController and it has beforeAction()
and there is a SiteController and it also has beforeAction() and it inherits from AppController
the problem is that the function from beforeAction() of the main controller will not work when working. and beforeAction() SiteController works fine,
what did I do wrong? or missed something?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
Dmitry, 2017-06-24
@dilikpulatov

Good afternoon.
It's just that in the child controller you override the parent's before action.
Try doing this:

parent:before action();
// далее Ваш код

ps
I'm writing from the phone, it's not very convenient, but I think you understand.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question