Why do I need to include the class when overriding it?

I am overriding CGridView in the components folder. I have found that I need to include the CGridView file when I am overriding it. My question is, why do I have to include the CGridView file? Is there a way to autoload it so that I do not have to include it?

Following is an example of my component file:




Yii::import('zii.widgets.grid.CGridView');


class PGridView extends CGridView

{

    ...

}



Classes in zii are not marked for autoload, that’s why you need to include it.

You can autoload it by adding following line under import in your config file

‘zii.widgets.grid.*’