As i undertand, Yii dont provides posibility to configure controllers via application configuration?
It is architectural problem of flexibility if i have no way to do that.
As i undertand, Yii dont provides posibility to configure controllers via application configuration?
It is architectural problem of flexibility if i have no way to do that.
How do you mean? If you look in protected/components there is Controller.php file. This is the base class for all controllers that you can extend from.
A controller is instantiated for answer to an html request, you have to implement one for each request you want to handle.
yah, that is right @zaccaria.
In OOP, you can add what you want in a new controller class, then all your controll classes implement it.
Also, in yii you can use actions() to add the common method.
I do so via Controller.php now, but i think, its not best way to do that.
It would be nice just add to controller configuration some events & behaviors, coz Controllers inherited from CComponent and allow this. Problem is only that we dont have a point to configure it in application configuration.
For example, i wont to publish some extensions for controllers, but it is bad idea to publish it as methods, that we ned to add to Controller.php
There has been some discussion on a related topic, see here: