3 final class FundInitiativeBackerTransaction
4 extends FundInitiativeTransactionType
{
6 const TRANSACTIONTYPE
= 'fund:backer';
8 public function generateOldValue($object) {
12 public function applyInternalEffects($object, $value) {
13 $amount = $this->getMetadataValue(
14 FundInitiativeTransaction
::PROPERTY_AMOUNT
);
15 $amount = PhortuneCurrency
::newFromString($amount);
16 $total = $object->getTotalAsCurrency()->add($amount);
17 $object->setTotalAsCurrency($total);
20 public function applyExternalEffects($object, $value) {
21 $backer = id(new FundBackerQuery())
22 ->setViewer($this->getActor())
23 ->withPHIDs(array($value))
26 throw new Exception(pht('Unable to load %s!', 'FundBacker'));
30 $subx[] = id(new FundBackerTransaction())
31 ->setTransactionType(FundBackerStatusTransaction
::TRANSACTIONTYPE
)
32 ->setNewValue(FundBacker
::STATUS_PURCHASED
);
34 $content_source = $this->getEditor()->getContentSource();
36 $editor = id(new FundBackerEditor())
37 ->setActor($this->getActor())
38 ->setContentSource($content_source)
39 ->setContinueOnMissingFields(true)
40 ->setContinueOnNoEffect(true);
42 $editor->applyTransactions($backer, $subx);
45 public function getTitle() {
46 $amount = $this->getMetadataValue(
47 FundInitiativeTransaction
::PROPERTY_AMOUNT
);
48 $amount = PhortuneCurrency
::newFromString($amount);
50 '%s backed this initiative with %s.',
51 $this->renderAuthor(),
52 $amount->formatForDisplay());
55 public function getTitleForFeed() {
56 $amount = $this->getMetadataValue(
57 FundInitiativeTransaction
::PROPERTY_AMOUNT
);
58 $amount = PhortuneCurrency
::newFromString($amount);
60 '%s backed %s with %s.',
61 $this->renderAuthor(),
62 $this->renderObject(),
63 $amount->formatForDisplay());
66 public function getIcon() {
70 public function getColor() {