Fatal Error : Class Not Found


I try to create a cron job for my newsletter.

when I try to execute the script an error shows up :

Fatal error : class 'ModelClass' not found in ..../cronjob.php on line 42

PHP Stack trace :

PHP 1. {main}() ......../cronjob.php:0

in line 43 in the script I use this findByPk() like below

$model = ModelClass::findByPk($id);

I thought that i have to link this model with the script

so i add in up of the script this line

require_once dirname(__FILE__).'/......./ModelClass.php';

But it brings the same error but with the class ActiveRecords.php

Is any one knows a Final solution for this.

Thank you in advance for your help

Try :

$model = ModelClass::model()->findByPk($id);


i change it but still same problem :(

Try to add :

$ModelPath = 'application.models.*';


Hello maher,

How do you call your cron job?