CraueFormFlowBundle icon indicating copy to clipboard operation
CraueFormFlowBundle copied to clipboard

Different bound entity based on flow step

Open daFish opened this issue 13 years ago • 4 comments

Hi there.

I'm currently struggling to find a solution for the following: I want to change the underlying entity of a form based on a step in the flow, e.g. due to usage of class table inheritance (CTI).

Has anyone done this yet?

daFish avatar Feb 18 '13 14:02 daFish

I just tried that, but failed due to setDefaultOptions (where I would switch to the more specific entity using the data option) being called after buildForm (where I wanted to add a field for an attribute in the more specific entity) in the form type.

craue avatar Feb 20 '13 13:02 craue

Hmm, that sucks. Maybe @bschussek has some insight form ninja tricks he can share with us?

daFish avatar Feb 20 '13 13:02 daFish

Setting data in getFormOptions of the flow class would do. But I still can't make it work properly. This needs some further investigation.

craue avatar Feb 20 '13 14:02 craue

Not sure how your flow looks like, but you could prepend a simple form to let the user choose which specific flow to use. So you could start with the desired entity right away.

craue avatar Feb 25 '13 17:02 craue