I am trying to establish a best-practice pattern for ReST clients in Symfony 2, as this is a very common job for us at my company, where we have Symfony apps on the frontend edge talking to Java based backends over HTTP/ReST.
My thinking is this, these services fill the "Repository" role in DDD for the particular domain in question . Based on the conventions specified by Doctrine, these would go in Repository classes that return Entity objects.
I think that same convention can work here as well, ReST client implement a Repository class using a library like Guzzle or just straight Curl, doesn't matter how, and then the code there does basic transformations from XML or JSON from and back to Entity objects for the upstream developer to manipulate. This is consistent with the patterns in other Symfony 2 use-cases and makes sense from a DDD standpoint.
Does anyone see a problem with this or a better way to do it?