Remove all "FileHasObject" edge reads and writes
[phabricator.git] / src / applications / calendar / xaction / PhabricatorCalendarEventRecurringTransaction.php
blob9e4904085ffdd078954552cebb74dc97d86455a7
1 <?php
3 final class PhabricatorCalendarEventRecurringTransaction
4 extends PhabricatorCalendarEventTransactionType {
6 const TRANSACTIONTYPE = 'calendar.recurring';
8 public function generateOldValue($object) {
9 return (int)$object->getIsRecurring();
12 public function generateNewValue($object, $value) {
13 return (int)$value;
16 public function isInheritedEdit() {
17 return false;
20 public function shouldHide() {
21 // This event isn't interesting on its own, and is accompanied by an
22 // "alice set this event to repeat weekly." event in normal circumstances
23 // anyway.
24 return true;
27 public function applyInternalEffects($object, $value) {
28 $object->setIsRecurring($value);
31 public function validateTransactions($object, array $xactions) {
32 $errors = array();
34 $old = $object->getIsRecurring();
35 foreach ($xactions as $xaction) {
36 if ($this->isNewObject()) {
37 continue;
40 if ($xaction->getNewValue() == $old) {
41 continue;
44 if ($xaction->getNewValue()) {
45 continue;
48 $errors[] = $this->newInvalidError(
49 pht(
50 'An event can not be stopped from recurring once it has been '.
51 'made recurring. You can cancel the event.'),
52 $xaction);
55 return $errors;