Editing the default User table

Hi!

I’m trying to add some fields to the User table that comes with the initial migration of the Advanced template. I already added the extra fields on the User model:




public $name;

public $surname;



and the rules for those fields




[['name', 'surname'], 'required'],



and also aded the fields on the form:




<?= $form->field($model, 'name') ?>

<?= $form->field($model, 'surname') ?>



but when I try to create or update the data in the table (using the CRUD generated by the Gii tool) the extra fields are still empty. Do I need to add something else to the model?

Remove them. ActiveRecord uses some runtime introspection magic, if you add new columns to the table, they will appear in your model automatically as public properties.

I tried modifying the tables on the database but I it seams not to be aware of those changes… I’m using mamp, should I restart the server after altering the database tables?

No, just flush/delete schema cache if enabled.

Thanks!!!