Inheriting From Custom Controller Class - Not Found


class SomeController extends Controller

{


	public function actionIndex() {

		echo 'This is some controller';

	}

}


class AnotherController extends SomeController

{


	public function actionIndex() {

		echo 'This is another controller';

	}

}

index.php?r=some

works…

index.php?r=another

says:

PHP warning

include(SomeController.php): failed to open stream: No such file or directory

Both of the files are in

test\protected\controllers\

BTW in the past I also tried using the Gii Controller Generator with "SomeController" as the base class…

It said:

The controller has been generated successfully. You may try it now.

Generating code using template "C:\xampp\htdocs\yii\framework\gii\generators\controller\templates\default"…

generated controllers\YetAnotherController.php

generated views\yetAnother\index.php

done!

When I clicked on "try it now" it also said:

PHP warning

include(SomeController.php): failed to open stream: No such file or directory

Hi it looks like SomeController has to be in /protected/components/ or the new controller needs the following line:

Yii::import(‘application.controllers.SomeController’);