Created
August 17, 2012 22:14
-
-
Save thecodedrift/3383208 to your computer and use it in GitHub Desktop.
PHP transaction managers
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| $btm = new BankTransactionManager($transaction); | |
| // create entry (Account, Entry Type) | |
| $e = $btm->createEntry("Gold.Gold"); | |
| $e->setUserId($user_id); | |
| $e->addGold($gold_amount); | |
| $btm->addEntry($e); | |
| $e = $btm->createEntry("ServerGold.Gold"); | |
| $e->setUserId(ENTITY_SERVER); | |
| $e->subtractGold($gold_amount); | |
| $btm->addEntry($e); | |
| try { | |
| $btm->execute(); | |
| } | |
| catch (Exception $e) { | |
| throw $e; | |
| } | |
| ?> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| SELECT "columns" FROM "table" WHERE "criteria" FOR UPDATE; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment