creating a ManyToMany relation in a doctrine entity, will result in rendering as a multiple select or checkboxlist, depending on the configuration.
I’m breaking my head over creating this while having the same relationship, but with OneToMany / ManyToOne relations.
Consider Product > ProductColors < Color. In Form type we define the ProductType with productColors as CollectionType, referencing the ProductColorsType. In ProductColorsType we define the EntityType to the entity class Color. This will result in the form_row creating multiple rows, each having a single select with the color options.
Creating a ManyToMany Product – Colors, and setting Color to EntityType, with multiple to true will result in a multiple select.
How can i set this relation in the FormTypes, so the OneToMany / ManyToOne behaves the same as setting a ManyToMany?
Source: Symfony Questions
Was this helpful?
0 / 0