Extending existing Class in Symfony

Posted by Dar Hamid on Stack Overflow See other posts from Stack Overflow or by Dar Hamid
Published on 2012-03-29T11:27:30Z Indexed on 2012/03/29 11:29 UTC
Read the original article Hit count: 293

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

© Stack Overflow or respective owner

Related posts about symfony

Related posts about symfony-2.0