Soliciting for ideas for a PHP 5 based transaction coordinator
<p>I'm hoping someone can provoke some ideas or provide references to material for creating a "transaction coordinator" implementation in PHP 5.  The driver is based on a multi-vendor single business process integration.  Due to potential failure points I'd like to avoid spaghetti code with tons of if's, switches, try..catches and have a coordinator that can intercept method calls, track responses to subsequent calls and interrogate a methods attribute to determine what compensation function to use to reverse the transaction.  The intent is to create an "ACID" like processing.  The closing thing I can reference would be the TransactionScope object in .Net. </p>

<p>A sample scenario:</p>

<pre><code>ServiceA
ServiceB
ServiceC

ServiceA-&gt;DoSomething() - passes
ServiceB-&gt;DoSomething() - passes
ServiceC-&gt;DoSomething() - fails
</code></pre>

<p>at this point A &amp; B must employ some type of compensation strategy to call functionality that will return state be it a database, third party integration or otherwise back to its original state. </p>

<p>My initial thoughts are to use some type of AOP to hold a reference to the compensator and the state requirements to complete the reversal activity.  Than a coordinator would need to keep track of executions, as well as returned state of executions to allow for the call to the compensator.</p>
