Autoloading with wildcards is not working in ConsoleCommand


I am creating a testdrive application from scratch via console as descried here:

Then I change my config/console.php to:

return array(


	'name'=>'My Console Application',


	// autoloading model and component classes






	// application components



			'connectionString' => 'sqlite:'.dirname(__FILE__).'/../data/testdrive.db',




I created a class in protected/models:

class Foo {


	public function foo() {

		echo "foo";



My console command looks like that:

class FooCommand extends CConsoleCommand  {


	public function actionIndex() {

		$foo = new Foo();

		echo $foo->foo();




Finally on my console I call:

yiic foo

And get:

Fatal error: Class 'Foo' not found in C:\ProgrammeNI\xampp2\htdocs\testdrive\pro

tected\commands\FooCommand.php on line 5

Call Stack:

    0.0008     323712   1. {main}() C:\ProgrammeNI\xampp2\htdocs\testdrive\prote


    0.0017     334784   2. require_once('C:\ProgrammeNI\xampp2\htdocs\yii\framew

ork\yiic.php') C:\ProgrammeNI\xampp2\htdocs\testdrive\protected\yiic.php:7

    0.0197    1272456   3. CApplication->run() C:\ProgrammeNI\xampp2\htdocs\yii\


    0.0197    1272456   4. CConsoleApplication->processRequest() C:\ProgrammeNI\


    0.0197    1272456   5. CConsoleCommandRunner->run() C:\ProgrammeNI\xampp2\ht


    0.0222    1403352   6. CConsoleCommand->run() C:\ProgrammeNI\xampp2\htdocs\y


    0.0224    1404352   7. ReflectionMethod->invokeArgs() C:\ProgrammeNI\xampp2\


    0.0224    1404368   8. FooCommand->actionIndex() C:\ProgrammeNI\xampp2\htdoc


The complete project is attached. Auto-loading works fine in my web applications.

Following lines added to FooCommand working as follows:

Yii::import('application.models.Foo'); //WORKS

Yii::import('application.models.*'); //FATAL ERROR

Why is the wildcard not working for my console?

I am using Xammp 1.74 with PHP 5.3.5 on Windows 7.

Furthermore I did some debugging in YiiBase::import() and the full path to proctected/models is actually added to the PHP include_path.

This is very strange!

I did a little more research and this is a workaround for me:

	public function run($args) {

		Yii::$enableIncludePath = false;



But I still don’t understand why


fails when the include path to protected/models is set correctly (and works perfect on all CWebApplications).