Console Command and model relations

Hi all,

I’m trying to run a console command but for some reason I cannot use the CActiveRecord::with() to get the records.

If I do:


$events = EventsDates::model()->findAll();

works fine, but if I do:


$events = EventsDates::model()->with('events')->findAll();

it just won’t work and I do not get an error, not even the log works.

I know the relation is OK because if I do the same code in the application with a controller/action it works perfectly.

My console.php:


return array(

...

'import'=>array(

        'application.models.*',

        'application.extensions.*',

        'application.components.*',

        'application.extensions.mail.*',  

),

'components'=>array(

...

'db'=>array(

            'connectionString' => 'mysql:host=localhost;dbname=my_db',

            'emulatePrepare' => true,

            'username' => 'username',

            'password' => 'password',

            'charset' => 'utf8',

            'enableProfiling' => true,

	    'enableParamLogging'=>true,

        ),

...

),

...

);



Can someone please help me and tell me what I’doing wrong.

Thanks

It was my error, sorry.

Could you please post your working version of your code so there is a benefit for users having a similar problem, thx.