Extending existing Class in Symfony
- by Dar Hamid
I am new to symfony. I have created a registration form using the code:
$user = new Register();
$form = $this->createForm(new RegisterType(), $user);
In the RegisterType class i have 5 fields (for example).I store the values in database when the user registers with the system. Now I display the EDIT page using following code:
$user = $em->getRepository('MysiteUserBundle:Register')->find($id);
$form = $this->createForm(new RegisterType(), $user);
The problem with the EDIT code however is that it displays me all of the fields mentioned in RegisterType class.Is it possible to display only some fields. If yes how can this be achieved. Any help will be appreciated