ajaykau / yii-user

Automatically exported from code.google.com/p/yii-user
0 stars 0 forks source link

Default Values not set #127

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1.Create a Custom Field with a default value
2.Change the default value for the field (directly in the DB)
3.Register a new User

What is the expected output? What do you see instead?
Is getting the default value for the field from the original value.

Original issue reported on code.google.com by xala...@gmail.com on 24 Jan 2012 at 6:55

GoogleCodeExporter commented 9 years ago
Added this to Profile model..

    public function beforeSave() {
        if ($this->isNewRecord){ //los defaults
            $fv = ProfileField::model()->findAll();
            foreach($fv as $f){
                $this[$f->varname] = $f->default;
            }
        }
        return parent::beforeSave();
    }

may not be the best solution .. :|

Original comment by xala...@gmail.com on 24 Jan 2012 at 7:11