1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-12-18 19:40:55 +01:00
phorge-phorge/src/applications/calendar/xaction/PhabricatorCalendarEventDateTransaction.php

32 lines
753 B
PHP
Raw Normal View History

<?php
abstract class PhabricatorCalendarEventDateTransaction
extends PhabricatorCalendarEventTransactionType {
abstract protected function getInvalidDateMessage();
public function generateNewValue($object, $value) {
$editor = $this->getEditor();
return $value->newPhutilDateTime()
->setIsAllDay($editor->getNewIsAllDay())
->newAbsoluteDateTime()
->toDictionary();
}
public function validateTransactions($object, array $xactions) {
$errors = array();
foreach ($xactions as $xaction) {
if ($xaction->getNewValue()->isValid()) {
continue;
}
$message = $this->getInvalidDateMessage();
$errors[] = $this->newInvalidError($message, $xaction);
}
return $errors;
}
}