A
A
atis //2016-07-21 11:13:01
Yii
atis //, 2016-07-21 11:13:01

How to run the model before the controller runs?

It is necessary to define an invite to the site.
There is a model that parses the url (special parameter). It must be run BEFORE any controller. For each controller is not an option to call.
Am I doing everything right?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
V
Vladimir Korovin, 2016-07-21
@atis2345

Or write a component by implementing the yii\base\BootstrapInterface interface , write it in the config in the components and bootstrap section and you will be happy.

M
Maxim Fedorov, 2016-07-21
@qonand

разбором и формированием url должен заниматься url-менеджер, если в проекте есть какие-то особенности url тогда стоит переопределять этот компонент

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question