Different bound entity based on flow step
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?
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.
Hmm, that sucks. Maybe @bschussek has some insight form ninja tricks he can share with us?
Setting data in getFormOptions of the flow class would do. But I still can't make it work properly. This needs some further investigation.
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.