New to Symfony2, I'm building an app that uses an external API to get data. I created a lot of client classes to retrieve and transform each entity from the API, and I defined those classes as services - e.g., I have a FooClient
with methods like getAll()
or getThoseThatInterestMe($me)
, which return data from the API.
Now I wanted to create a ApiClientFacade
class, which acts as an interface in front of all the XxxClient
classes, following the Facade Pattern - e.g., this facade class would have a method getAllFoo()
, which in turn would call FooClient::getAll()
, and so on...
I could define my facade class as a service as well, but it'd have too many dependencies - I have around 30 client classes. Also, afaik with this approach I'd be loading all 30 dependencies every time, while most of the times I'd only need one dependency...
So, is there a better way to do this?