Remove all "FileHasObject" edge reads and writes
[phabricator.git] / src / applications / calendar / xaction / PhabricatorCalendarEventAllDayTransaction.php
blob325f53757aa15362dee7ad2d3495fe4d38b12ffe
1 <?php
3 final class PhabricatorCalendarEventAllDayTransaction
4 extends PhabricatorCalendarEventTransactionType {
6 const TRANSACTIONTYPE = 'calendar.allday';
8 public function generateOldValue($object) {
9 return (int)$object->getIsAllDay();
12 public function generateNewValue($object, $value) {
13 return (int)$value;
16 public function applyInternalEffects($object, $value) {
17 $object->setIsAllDay($value);
19 // Adjust the flags on any other dates the event has.
20 $keys = array(
21 'startDateTime',
22 'endDateTime',
23 'untilDateTime',
26 foreach ($keys as $key) {
27 $dict = $object->getParameter($key);
28 if (!$dict) {
29 continue;
32 $datetime = PhutilCalendarAbsoluteDateTime::newFromDictionary($dict);
33 $datetime->setIsAllDay($value);
35 $object->setParameter($key, $datetime->toDictionary());
39 public function getTitle() {
40 if ($this->getNewValue()) {
41 return pht(
42 '%s changed this to an all day event.',
43 $this->renderAuthor());
44 } else {
45 return pht(
46 '%s converted this from an all day event.',
47 $this->renderAuthor());
51 public function getTitleForFeed() {
52 if ($this->getNewValue()) {
53 return pht(
54 '%s changed %s to an all day event.',
55 $this->renderAuthor(),
56 $this->renderObject());
57 } else {
58 return pht(
59 '%s converted %s from an all day event.',
60 $this->renderAuthor(),
61 $this->renderObject());