Pass vars from config files to a component

Hi, I have component in component dir that connect to a DB. Now I would like to pass $table1, $table2, $table3 and so on as arguments from config file. Is it possible to do that, and how?

TIA

Danilo

Your component must extend from CApplicationComponent. For example:




class MyComponent extends CApplicationComponent

{


    public $table1;

    public $table2;


}



Then in config:


'components' => array(

   ...

   'myComponent' => array(

      'class' => 'MyComponent',

      'table1' => 'foo',

      'table2' => 'bar',

   ),

   ...

),

Thanks Y!! it works!

Can I set default value for $table if it is not defined in config file?

Thanks again




public $table1 = 'MyTable';



?

I’ve tried, but it doesn’t work

It was my mistake, it works.