Skip to content

Instantly share code, notes, and snippets.

@lasekio
Created February 8, 2016 17:21
Show Gist options
  • Save lasekio/a80f93d54c678e258366 to your computer and use it in GitHub Desktop.
Save lasekio/a80f93d54c678e258366 to your computer and use it in GitHub Desktop.
<?php
// ...
$account = $accountRepo->getAccount($id);
$accountBalance = $account->getBalance();
// nawet w tym momencie balance moze sie zmienic przez inny wątek / request / przerwanie
// nie należy spodziewać się, że kod będzie wykonywany zawsze synchronicznie
$accountBalance += $transaction->getAmount();
// jeszcze jakieś rzeczy
$account->getBalance($accountBalance);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment