I am interested in loading some system params into the Yii::app()->params
array from the database using a CActiveRecord
extension called SiteSetting
.
Unfortunately I couldn't find much advice online for this, but believe I can place a method in SiteSetting
called loadSiteSettingsToAppParams
and add the setting...
'onBeginRequest'=>array('SiteSetting', 'loadSiteSettingsToAppParams')
...to the config.
I would like to know if I can only add this onBeginRequest
to the Yii::app()
somewhere within the SiteSetting
class (to keep my code modular) and whether this is a sensible approach.
Thanks in advance.