Path: blob/master/src/applications/countdown/xaction/PhabricatorCountdownEpochTransaction.php
12256 views
<?php12final class PhabricatorCountdownEpochTransaction3extends PhabricatorCountdownTransactionType {45const TRANSACTIONTYPE = 'countdown:epoch';67public function generateOldValue($object) {8return (int)$object->getEpoch();9}1011public function generateNewValue($object, $value) {12return $value->newPhutilDateTime()13->newAbsoluteDateTime()14->getEpoch();15}1617public function applyInternalEffects($object, $value) {18$object->setEpoch($value);19}2021public function getTitle() {22return pht(23'%s updated the countdown end from %s to %s.',24$this->renderAuthor(),25$this->renderOldDate(),26$this->renderNewDate());27}2829public function getTitleForFeed() {30return pht(31'%s updated the countdown end for %s from %s to %s.',32$this->renderAuthor(),33$this->renderObject(),34$this->renderOldDate(),35$this->renderNewDate());36}3738public function validateTransactions($object, array $xactions) {39$errors = array();4041if (!$object->getEpoch() && !$xactions) {42$errors[] = $this->newRequiredError(43pht('You must give the countdown an end date.'));44return $errors;45}4647foreach ($xactions as $xaction) {48$value = $xaction->getNewValue();49if (!$value->isValid()) {50$errors[] = $this->newInvalidError(51pht('You must give the countdown an end date.'));52}53}5455return $errors;56}57}585960