I have tried to put it inside safe attributes as well. Nothing works. here is the code.
class Users extends CActiveRecord
{
public $password1;
public $password2;
public $password3;
public function safeAttributes()
{
return array('password1');
}
public function rules()
{
return array(
array('EMAIL,FIRSTNAME', 'required'),
array('EMAIL', 'length', 'max'=>Signup::email_length),
array('FIRSTNAME', 'length', 'max'=>Signup::firstname_length),
array('LASTNAME','length','max'=>Signup::lastname_length),
// email has to be a valid email address
array('EMAIL', 'email'),
array('password1','required','message'=>'Password cannot be blank.'),
array('password1','length','max'=>Signup::password_length),
// passwords must match
array(‘password2’,‘compare’,‘compareAttribute’=>‘password3’,‘message’=>‘New Passwords must match’),
array('password1','CheckCurrentPassword'),
array('EMAIL', 'CheckIfUnique'),
);
}
}
and in the controller. i am doing this to check it out
$model =$this-> loadUsers(Yii::app()->user->id);
echo "<pre>";
print_r($model->attributes);
echo "</pre><br />";
if (isset($_POST['Users']))
{
$model = new Users;
echo "<pre>";
print_r($model->attributes);
echo "</pre><br />";
}
The output i am getting is
<pre>
Array
(
[ID] => 17
[EMAIL] => arvind@arvind.com
[PASSWORD] => 70bf9c1f150c32fd4bda1da1ee21b86ff7c58326a6a998dfbdaf0292efcab232
[FIRSTNAME] => Arvind
[LASTNAME] => Rangan
[DISABLED] => 0
)
</pre>
<pre>
Array
(
[ID] =>
[EMAIL] =>
[PASSWORD] =>
[FIRSTNAME] =>
[LASTNAME] =>
[DISABLED] =>
)
</pre>
so for now, i have to asign it manually.
Am i missing something ?
Arvind
P.S. never mind. it suddenly started working by itself.
But still it will not show the declared fields as part of the attributes, when u try to do a print_r($model->attributes).