[SOLVED] yiic model problem

hi!

i have a problem when i want to use my exisiting models from /protected/models with yiic.

i have created /protected/commands/StatisticCommand.php with this content:


class StatisticCommand extends CConsoleCommand 

{

	public function run($args)

	{

		echo "run";

		$model_statistic = StatisticOnline::model()->findAll();

		var_dump($model_statistic);

	}

	

	public function actionDay() {

		echo "day";

	}


}

in the console i am in the protected folder.

when i try to run statistic (./yiic statistic) i get an include error.

**** is not the real path ;)

content of /protected/config/console.php


return array(

	'basePath' => dirname(__FILE__).DIRECTORY_SEPARATOR.'..',

	'name' => '**** Console',

	

	// application components

	'components' => array(

		'db' => array(

			'connectionString' => 'pgsql:host=192.168.2.149;port=5840;dbname=XYZ',

			'emulatePrepare' => true,

			'username' => 'user',

			'password' => 'pass',

			'charset' => 'utf8',

		),

	),

);

whats wrong or missing?

thanks

You need to import models in your config:




'import'=>array(

    'application.models.*',

),



or import a single model in your command class:




Yii::import('application.models.StatisticOnline', true); // "true" is to include a file immediately



argh so easy … i should stop working for today -.-

thank you :)