Path: blob/master/src/applications/calendar/xaction/PhabricatorCalendarEventHostTransaction.php
12256 views
<?php12final class PhabricatorCalendarEventHostTransaction3extends PhabricatorCalendarEventTransactionType {45const TRANSACTIONTYPE = 'calendar.host';67public function generateOldValue($object) {8return $object->getHostPHID();9}1011public function applyInternalEffects($object, $value) {12$object->setHostPHID($value);13}1415public function getTitle() {16return pht(17'%s changed the host of this event from %s to %s.',18$this->renderAuthor(),19$this->renderOldHandle(),20$this->renderNewHandle());21}2223public function getTitleForFeed() {24return pht(25'%s changed the host of %s from %s to %s.',26$this->renderAuthor(),27$this->renderObject(),28$this->renderOldHandle(),29$this->renderNewHandle());30}3132public function validateTransactions($object, array $xactions) {33$errors = array();3435foreach ($xactions as $xaction) {36$host_phid = $xaction->getNewValue();37if (!$host_phid) {38$errors[] = $this->newRequiredError(39pht('Event host is required.'));40continue;41}4243$user = id(new PhabricatorPeopleQuery())44->setViewer($this->getActor())45->withPHIDs(array($host_phid))46->executeOne();47if (!$user) {48$errors[] = $this->newInvalidError(49pht(50'Host PHID "%s" is not a valid user PHID.',51$host_phid));52}53}5455return $errors;56}5758}596061