views:

21

answers:

1

I just created a custom schema formatter by extending sfWidgetFormSchemaFormatter for my forms. However, what is sad to know is that to use it, I need to specify that in the configure() method of every form I use, which is kinda painful.

Writing this in the BaseForm is a good idea, but the problem is that ModelForm & BaseModelForm don't implicitly call the BaseForm :(

Is there a way out to do this generically?

+2  A: 

All doctrine forms extend from BaseFormDoctrine you can put it in the setup method.

Make sure that if you overload setup() any where else to call self::parent()

johnwards
Thanks a ton! This works!all BaseModelForms extend BaseFormDoctrine and call parent::setup() in their setup(), so your solution is fool-proof unless I override setup() in my form!For my understanding, Can you help me an instance where overriding setup() would be required?for me, most of the stuff gets done in the configure() method
Prasad
I believe the idea is that setup should always call the setup of it's parent. configure should never call the parent configure. You are setting up the "stack" then you are configuring your class...well that is how I look at it.
johnwards