A Way To Get Setting Values

Hi, I have a Setting model that reads all value from ‘setting’ table (key => value) and stores the final array into a CMap. ‘setting’ table has ‘category’, ‘key’ and ‘value’ fields among others.

Now I would like to find a way to do something like that, from any Controller:

  • $this->setting->category returns an array with all keys with values

  • $this->setting->category->key returns ‘value’

For example:

  • $this->setting->mail returns array(‘mail_1’=>‘foo@example.com’,‘mail_2’=>‘bar@example.com’,‘mail_3’=>‘yii@example.com’)

  • $this->setting->mail->mail_1 returns the string ‘foo@example.com’

Do you think it is possible? Now, I’m retrieve values using a normal array: $this->setting[‘mail’] and $this->setting[‘mail’][‘mail_1’]

Thanks in advance.

Danilo Di Moia