jonghwa
(Nasiajai)
1
Hi.
I would like to get key/value in config/main.php in compoments/UserIdentity.php.
It doesn’t seem to work when I access Yii::app()->controller->module or Yii::app()->getModule(‘MyModule’)
because UserIdenty is not in a module.
What’s the proper way to get variables set in config/main.php from components?
jonghwa
(Nasiajai)
2
hmmm… I now access the variables like this.
config/main.php
'modules'=>array(
'MyModule'=>array(
'key'=>'value',
),
),
components/UserIdentity.php
$key = Yii::app()->modules['MyModule']['key']
I want to know if there’s a better way.