Symfony2 passing values to collection form type

前端 未结 3 1062
爱一瞬间的悲伤
爱一瞬间的悲伤 2021-01-02 16:52

I have the following entity relations:

  • A Customer has one-to-many Address
  • An Address has many-to-one County and many-to-one City
  • A County has
3条回答
  •  梦毁少年i
    2021-01-02 17:38

    I think you could use the 'options' option of the collection type. It's better than using the constructor in case you want to reuse the form elsewhere.

    Symfony Form Reference: Collection Type

    But remember to define the variable in your setDefaultOptions method. (Both forms must have it)

提交回复
热议问题