As far as I know, it's not possible to have multiple values for
data_class.

You would need a different FormType for each of the subclasses. I
would suggest having the user pick which type of "thing" they want to
create first, then displaying the correct form based on that choice.
Trying to have a single form handle multiple types of objects is going
to get messy.

If you wanted to give the illusion of a single form to the end user,
you can always have the combobox in Manu's example trigger an AJAX
update that updates the page with the correct type of form. If done
correctly, the user wouldn't be able to tell the difference between
this implementation and Manu's original idea.

On May 5, 4:06 am, Vincent Lechemin <[email protected]>
wrote:
> On Thu, May 5, 2011 at 9:41 AM, Manu <[email protected]> wrote:
> > How does Symfony2 handle inheritance ?
>
> This also interests me, what's the best way to make a form with
> inheritance having multiple possibilities for data_class?
>
> --
> Vincent

-- 
If you want to report a vulnerability issue on symfony, please send it to 
security at symfony-project.com

You received this message because you are subscribed to the Google
Groups "symfony users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/symfony-users?hl=en

Reply via email to