Skip to content

Instantly share code, notes, and snippets.

@adri
Created September 26, 2018 14:32
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save adri/1f00dd08d3ce4139d096bb3abb5a34e3 to your computer and use it in GitHub Desktop.
Save adri/1f00dd08d3ce4139d096bb3abb5a34e3 to your computer and use it in GitHub Desktop.
Example usage of setting dependent objects properties without creating a new object.
<?php
$payout = Factory::create()
->withPayment(function (PaymentContext $payment) {
$payment->amount = new Money(1337, new Currency('USD'));
})
->payout(function (PayoutContext $payout) {
$payout->payoutId = PayoutId::fromString('03f74472-0e31-4d5c-8f61-bf34bda2dcb2');
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment