when trying to create a model I get this error message Class ‘CActiveRecord’ not found pls why do i keep getting that error and what’s the possible solution
when trying to create a model I get this error message Class ‘CActiveRecord’ not found pls why do i keep getting that error and what’s the possible solution
Post model code
class Jobseeker extends CActiveRecord
{
public $password_repeat;
public $new_password;
public $holdPassword;
public $month,$year,$day;
public $Category;
public $Provider;
public $advertmeans;
public $alertStatus;//whether alert has been sent for the day or not
/**
* Returns the static model of the specified AR class.
* @param string $className active record class name.
* @return Jobseekers the static model class
*/
protected function afterValidate()
{
if(Yii::app()->session['scenario']==""){
parent::afterValidate();
$this->password=Companydetails::model()->encrypt($this->password);
$this->password_repeat= Companydetails::model()->encrypt($this->password_repeat);
}
/**/
//$this->new_password=Companydetails::model()->encrypt($this->new_password);
// if(!empty($this->password_repeat))
// $this->password=Companydetails::model()->encrypt($this->password_repeat);
}
public static function model($className=__CLASS__)
{
return parent::model($className);
}
/**
* @return string the associated database table name
*/
public function tableName()
{
return 'jobseekers';
}
/**
* @return array validation rules for model attributes.
*/
public function rules()
{
// NOTE: you should only define rules for those attributes that
// will receive user inputs.
return array(
array('email','required','on'=>'forgotPassword'),
array('email, Address, City, State, Country, Phone, DOB, Sex,year,month,day', 'required','on'=>'demography'),
array("email,Phone,LastName,FirstName,password,Category,Sex,password_repeat",'required','on'=>"modal"),
array('password, FirstName, LastName,email,City, State, Country,Phone', 'required','on'=>'skillfest'),
array('password, FirstName, LastName,email', 'required','on'=>'socialUser'),
array('FirstName, LastName', 'required','on'=>'name'),
array("email, password, FirstName, LastName,password_repeat,DOB, Sex,year,month,day,City,Country,State",'required','on'=>'quickreg'),
array('password','compare','on'=>'quickreg'),
//array('password_repeat,email, password, FirstName, LastName, Address, City, State, Country, Phone, DOB, Sex,year,month,day', 'required','on'=>'newRegistration'),
array('email, FirstName, LastName, City, State, Nationality, Country', 'length', 'max'=>100),
array('FirstName, LastName', 'length', 'max'=>15),
array('password', 'length', 'max'=>300),
array('Phone, MaritalStatus', 'length', 'max'=>20),
array('Sex', 'length', 'max'=>10),
array('Phone','numerical'),
array('email','email'),
array('advertmeans','required','message'=>'Select how you heard about us.', 'on'=>'skillfest,demography,quickreg'),
array('email','unique','on'=>'demography,newRegistration,quickreg,skillfest,socialUser,modal',),
array("password_repeat,year,month,day,advertmeans","safe"),
array('DOB','date', 'format'=>array('yyyy-MM-dd','yyyy-MM-dd'), 'allowEmpty'=>false,'message'=>'The format of Date of birth is invalid. Example YYYY-MM-DD','on'=>'newRegistration,demography,quickreg'),
// The following rule is used by search().
// Please remove those attributes that should not be searched.
);
}
Has the model a namespace definition at top?
I would like to jump onto this.
I am very new to yii, installed it with the following composer call:
composer create-project --prefer-dist yiisoft/yii2-app-basic basic
But the directory /vendor/yiisoft/yii2/db/ar is missing.
The I tried to get it from github. Just to discover that CActiveRecord extends CModel, which I also don’t have.
I don’t understand why. I’am not shure, if I have to install an extension. If yes, then which one?
If I look to the API-Documentation it looks to me, as if CActiveRecord is part of the core.
I am a little bit confused. May someone explain to me, what’s wrong?