another approach is to not even do it in the library or not inside this class. ie. we could use inheritance to add this feature into a subclass that can either be shipped with Elastica or with FOQElasticaBundle if you think this is a too Symfony2 eco-system specific feature.