I want to pass the parameters while creating the new model object. So that created model object will have those parameter values.
Eg:
$student_obj = new Student($student_name);
class Student extends CActiveRecord() {
public function __construct($student_name){
parent::__construct();
if($student_name == "")
throw Exception;
$this->student_name = $student_name;
}
}
Tried with constructors. Doesn’t work. While loading the model objects gives error as we need to pass those constructor parameters.(findByPk(1)). How can i do this.