I've got a need to set a parameter into some queries that comes from the symfony2 configuration.
Normally you would pass that parameter from outside the repository class, but in this case I don't want to do that.
I've looked at a custom function (as that is already in play as well), but I can't use a service as custom function for Doctrine. So I would need to do some nasty things to get the parameter from the ServiceContainer. Something similar is the case for SqlWalkers.
I think the best might even be to push the parameter into the Doctrine Configuration object or EntityManager. This would allow me to fetch the parameter from the Query object in the CustomFunction and add it to the query when needed.
If that is not possible a good alternative would be to have the parameter available in the Repository class. That way it would not need to be passed manually to the Repository class.
Is there a way to inject some custom parameter in the Doctrine Configuration? Or the Repository class? Does anyone has a better solution?