So, I'm looking for a solution for the following problem that would be "best practice" to implement in Symfony2.3.
Short description of situation: I've got a form defined in it's own class ("ProductType") The form contains a field that is linked to a different table. User needs to select 1 value from that list.
I want to restrict the values the user can choose from. Not all options that are found in the database are relevant. I need to dynamically reduce the options in the list based on information in the database and the current values already applied to the form. I can do this by adding a "Subscription" in which I change the contents of the form. But in this subscription I need access to the database/Doctrine Repository's to determine the list that the user may choose from.
So I need to inject Doctrine in the Subscription, but it is not available in the Type-class.
What is the best solution for this? - define the Subscription class as a service in Symfony and inject Doctrine via that route? - something else?
The Symfony documentation isn't very clear on this unfortunately.