Today I had a big win at work.
We’re building an SOA platform for the business, so different bits of data end up sitting on different services, contactable only via a RESTful API.
One of the roadblocks we hit was validating some Service B data entered into Service A. Symfony2’s built in validators do a great job when everything is available on the same box, in the same database, but falls completely flat when it needs to validate outside a service boundary.
So I figured out how to inject a DI container into a Callback validator on Service A, and proceeded to summon some other validator services that would query the existence of a particular resource entity residing on Service B via HTTP.
It’s late now, but I’ll share the code when I get a little more time. Leave a comment if you’re really desperate to find out how it was done.