Configuration Parameters Question

Hi all…

I'm building a REST API extension and it has three sub classes.

CApplicationComponent

|

APIComponent

|

– SpecificAPIGeneric

      |

      ---- MoreSpecificAPICall_A

      |

      ---- MoreSpecificAPICall_B

      |

      ---- MoreSpecificAPICall_C

The "Generic" base class is where all the configuration parameters need to be set (i.e. API url, API key, etc.)

In my main.php, I've created a component section for my base class. However, no matter what I try, the parameters are not read at runtime.

So my question is this: must I create a component config for the class I'm actually using instead of the parent class?  More directly, will the framework retrieve configuration parameters for the parent component as well as the instantiated component?

If Yii doesn't do this, is it something that should be considered in an upcoming release?

What do you mean by parent and child components here? Do you have both of them during runtime, or are they merely parent-child inheritance relationship?

Because Yii configuration is really about setting property initial values, a child component can always inherit the parent component's properties and thus can be configured.

Quote

What do you mean by parent and child components here? Do you have both of them during runtime, or are they merely parent-child inheritance relationship?

Because Yii configuration is really about setting property initial values, a child component can always inherit the parent component's properties and thus can be configured.

By parent/child I mean that I want to set params for the base class of my instantiated, not the instantiated class itself. The subclasses all share the same info. I don't want to set it three times.

I guess I will make my subclasses less specific.

Here's another issue I just realized…

I have my class config info (main.php) under the components area. However, what I've made is an "extension". Should it be a component? I'm unclear on the distinction.

In any case, should I add an 'extensions' section to the main.php to get the config params to be recognized?

An app component IS a kind of extension. When you configure it in app config (the components portion), its properties will be initialized.

Yeah, I know. I solved my issue. I combined my three subclasses into a single class.

My goal was to have one config params block for all three subclasses.

No worries. I'm going to post this to the extensions as soon as I get it cleared up. It's a component to talk to the Yelp API.