3 final class PhabricatorCountdownEpochTransaction
4 extends PhabricatorCountdownTransactionType
{
6 const TRANSACTIONTYPE
= 'countdown:epoch';
8 public function generateOldValue($object) {
9 return (int)$object->getEpoch();
12 public function generateNewValue($object, $value) {
13 return $value->newPhutilDateTime()
14 ->newAbsoluteDateTime()
18 public function applyInternalEffects($object, $value) {
19 $object->setEpoch($value);
22 public function getTitle() {
24 '%s updated the countdown end from %s to %s.',
25 $this->renderAuthor(),
26 $this->renderOldDate(),
27 $this->renderNewDate());
30 public function getTitleForFeed() {
32 '%s updated the countdown end for %s from %s to %s.',
33 $this->renderAuthor(),
34 $this->renderObject(),
35 $this->renderOldDate(),
36 $this->renderNewDate());
39 public function validateTransactions($object, array $xactions) {
42 if (!$object->getEpoch() && !$xactions) {
43 $errors[] = $this->newRequiredError(
44 pht('You must give the countdown an end date.'));
48 foreach ($xactions as $xaction) {
49 $value = $xaction->getNewValue();
50 if (!$value->isValid()) {
51 $errors[] = $this->newInvalidError(
52 pht('You must give the countdown an end date.'));