I have the user, which can register via form: name, lastname, email, phone, password, username.
Registered user can change: name, lastname, phone
My UserType
public function buildForm(FormBuilderInterface $builder, array $options)
{
$builder
->add('name', 'text')
->add('lastname', 'text')
->add('email', 'email')
->add('phone', 'text')
->add('password', 'text')
->add('username', 'text');
}
How should I render different form for registration and update?
Twig
view and inject the sameFormType
but only displayform_row()
that are needed. You'd need to bind your form with your entity though so data is present in the form when user is changing their profile. – D4V1D