How to pass parameter to FormType constructor from controller

后端 未结 3 1851
灰色年华
灰色年华 2020-12-13 18:31

In Symfony2.7 i was able to pass parameter to Form Type constructor directly from controller while creating the form, however in Symfony3 i\'m not able to do it!

3条回答
  •  甜味超标
    2020-12-13 19:17

    You are both right.

    @Muzafar and @jkucharovic, the question is when to use which...

    As Bernard Schussek shows in Symfony Forms 101:

    1 Don't pass Dynamic Data to constructor..

    2 ... but use Custom Options instead

    3 Do pass Global Settings to constructor (or services)

提交回复
热议问题