public function rules()
{
// NOTE: you should only define rules for those attributes that
// will receive user inputs.
return array(
array('first_name,username, last_name, email, tel, active, role, password', 'required'),
array('first_name,username, last_name, email, tel, active, role, password', 'allowEmpty' => true, 'on'=>'editaccount'),
array('first_name,name_of_principal_director_head_of_hr, location, grades_offered, years_offered, town_suburb_of_school_college_institution_company,describe_your_core_business, number_of_academic_lecturing_facilitation_staff_employed_on_an_a, number_of_learners_students_on_an_average_day, username, website_of_school_college_institution_company, phone_number_of_school_college_institution_company, name_of_school_college_institution_company, last_name, email, , profile_picture', 'length', 'max'=>255),
array('grades_offered','in','range'=>array('Gr00', 'Gr0', 'Gr1'), 'allowEmpty'=>false),
// The following rule is used by search().
// Please remove those attributes that should not be searched.
array('id,username, first_name,active, second_name,location, tel,name_of_principal_director_head_of_hr, grades_offered, years_offered, number_of_learners_students_on_an_average_day,describe_your_core_business, number_of_academic_lecturing_facilitation_staff_employed_on_an_a, website_of_school_college_institution_company, phone_number_of_school_college_institution_company,town_suburb_of_school_college_institution_company, email, name_of_school_college_institution_company, cell, password', 'safe', 'on'=>'search'),
array('image', 'file', 'types'=>'jpg, gif, png', 'maxSize'=>1024 * 1024 * 5, 'allowEmpty' => true),
array('image', 'file', 'types'=>'jpg, gif, png', 'maxSize'=>1024 * 1024 * 5, 'allowEmpty' => true, 'on'=>'editaccount'),
//array('verifyCode', 'captcha', 'on'=>'register'),
//array('verifyCode', 'captcha', 'on'=>'insert','allowEmpty'=>!CCaptcha::checkRequirements()),
);
}
Error :
Register has an invalid validation rule. The rule must specify attributes to be validated and the validator name.
133 * PHP setter magic method.
134 * This method is overridden so that AR attributes can be accessed like properties.
135 * @param string $name property name
136 * @param mixed $value property value
137 */
138 public function __set($name,$value)
139 {
140 if($this->setAttribute($name,$value)===false)
141 {
142 if(isset($this->getMetaData()->relations[$name]))
143 $this->_related[$name]=$value;
144 else
145 parent::__set($name,$value);
146 }
147 }
148
149 /**
150 * Checks if a property value is null.
151 * This method overrides the parent implementation by checking
152 * if the named attribute is null or not.
153 * @param string $name the property name or the event name
154 * @return boolean whether the property value is null
155 * @since 1.0.1
156 */
157 public function __isset($name)