2016-07-13 00:44:11 +02:00
|
|
|
<?php
|
|
|
|
|
|
|
|
abstract class PhabricatorCalendarEventDateTransaction
|
|
|
|
extends PhabricatorCalendarEventTransactionType {
|
|
|
|
|
|
|
|
abstract protected function getInvalidDateMessage();
|
|
|
|
|
|
|
|
public function generateNewValue($object, $value) {
|
2016-11-01 20:55:27 +01:00
|
|
|
$editor = $this->getEditor();
|
|
|
|
return $value->newPhutilDateTime()
|
|
|
|
->setIsAllDay($editor->getNewIsAllDay())
|
|
|
|
->newAbsoluteDateTime()
|
|
|
|
->toDictionary();
|
2016-07-13 00:44:11 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
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;
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|