Remove all "FileHasObject" edge reads and writes
[phabricator.git] / src / applications / calendar / xaction / PhabricatorCalendarEventReplyTransaction.php
blob2aad3d2bb24ac59574089bca2f328e496fb56bc6
1 <?php
3 abstract class PhabricatorCalendarEventReplyTransaction
4 extends PhabricatorCalendarEventTransactionType {
6 public function generateOldValue($object) {
7 $actor_phid = $this->getActingAsPHID();
8 return $object->getUserInviteStatus($actor_phid);
11 public function isInheritedEdit() {
12 return false;
15 public function applyExternalEffects($object, $value) {
16 $acting_phid = $this->getActingAsPHID();
18 $invitees = $object->getInvitees();
19 $invitees = mpull($invitees, null, 'getInviteePHID');
21 $invitee = idx($invitees, $acting_phid);
22 if (!$invitee) {
23 $invitee = id(new PhabricatorCalendarEventInvitee())
24 ->setEventPHID($object->getPHID())
25 ->setInviteePHID($acting_phid)
26 ->setInviterPHID($acting_phid);
27 $invitees[$acting_phid] = $invitee;
30 $invitee
31 ->setStatus($value)
32 ->save();
34 $object->attachInvitees($invitees);