I have created company controller, view and model files using Yii. Everything was working fine but now when I go to create a new company, it is showing me this error:
Fatal error: Class 'Company' not found in E:\projectsroot\@@@YII\admin\protected\controllers\CompanyController.php on line 65**
My controller code is:
<?
public function actionCreate()
{
$model=new Company;
// Uncomment the following line if AJAX validation is needed
// $this->performAjaxValidation($model);
if(isset($_POST['Company']))
{
$model->attributes=$_POST['Company'];
$model->created_at=date('Y-m-d H:i:s');
//$model->status='active';
$images_path = realpath(Yii::app()->basePath . '/../images/logo');
$file=CUploadedFile::getInstance($model,'image');
if($file){
$model->image=date('YmdHis').'.'.$file->extensionName;
$file->saveAs($images_path . '/' .$model->image);
}
else
{
$model->image='noimage.jpg';
}
if($model->save())
$this->redirect(array('view','id'=>$model->id));
}
$this->render('create',array(
'model'=>$model,
));
}
?>
I am getting the error on the line $model = new Company;
Can anyone help me understand the problem?