private function getTransactionOldValue(PhabricatorLiskDAO $object, PhabricatorApplicationTransaction $xaction)
 {
     switch ($xaction->getTransactionType()) {
         case PhabricatorTransactions::TYPE_SUBSCRIBERS:
             return array_values($this->subscribers);
         case PhabricatorTransactions::TYPE_VIEW_POLICY:
             return $object->getViewPolicy();
         case PhabricatorTransactions::TYPE_EDIT_POLICY:
             return $object->getEditPolicy();
         case PhabricatorTransactions::TYPE_JOIN_POLICY:
             return $object->getJoinPolicy();
         case PhabricatorTransactions::TYPE_EDGE:
             $edge_type = $xaction->getMetadataValue('edge:type');
             if (!$edge_type) {
                 throw new Exception("Edge transaction has no 'edge:type'!");
             }
             $old_edges = array();
             if ($object->getPHID()) {
                 $edge_src = $object->getPHID();
                 $old_edges = id(new PhabricatorEdgeQuery())->withSourcePHIDs(array($edge_src))->withEdgeTypes(array($edge_type))->needEdgeData(true)->execute();
                 $old_edges = $old_edges[$edge_src][$edge_type];
             }
             return $old_edges;
         case PhabricatorTransactions::TYPE_CUSTOMFIELD:
             // NOTE: Custom fields have their old value pre-populated when they are
             // built by PhabricatorCustomFieldList.
             return $xaction->getOldValue();
         case PhabricatorTransactions::TYPE_COMMENT:
             return null;
         default:
             return $this->getCustomTransactionOldValue($object, $xaction);
     }
 }
 private function getTransactionOldValue(PhabricatorLiskDAO $object, PhabricatorApplicationTransaction $xaction)
 {
     switch ($xaction->getTransactionType()) {
         case PhabricatorTransactions::TYPE_SUBSCRIBERS:
             return array_values($this->subscribers);
         case PhabricatorTransactions::TYPE_VIEW_POLICY:
             return $object->getViewPolicy();
         case PhabricatorTransactions::TYPE_EDIT_POLICY:
             return $object->getEditPolicy();
         case PhabricatorTransactions::TYPE_JOIN_POLICY:
             return $object->getJoinPolicy();
         case PhabricatorTransactions::TYPE_SPACE:
             $space_phid = $object->getSpacePHID();
             if ($space_phid === null) {
                 if ($this->getIsNewObject()) {
                     // In this case, just return `null` so we know this is the initial
                     // transaction and it should be hidden.
                     return null;
                 }
                 $default_space = PhabricatorSpacesNamespaceQuery::getDefaultSpace();
                 if ($default_space) {
                     $space_phid = $default_space->getPHID();
                 }
             }
             return $space_phid;
         case PhabricatorTransactions::TYPE_EDGE:
             $edge_type = $xaction->getMetadataValue('edge:type');
             if (!$edge_type) {
                 throw new Exception(pht("Edge transaction has no '%s'!", 'edge:type'));
             }
             $old_edges = array();
             if ($object->getPHID()) {
                 $edge_src = $object->getPHID();
                 $old_edges = id(new PhabricatorEdgeQuery())->withSourcePHIDs(array($edge_src))->withEdgeTypes(array($edge_type))->needEdgeData(true)->execute();
                 $old_edges = $old_edges[$edge_src][$edge_type];
             }
             return $old_edges;
         case PhabricatorTransactions::TYPE_CUSTOMFIELD:
             // NOTE: Custom fields have their old value pre-populated when they are
             // built by PhabricatorCustomFieldList.
             return $xaction->getOldValue();
         case PhabricatorTransactions::TYPE_COMMENT:
             return null;
         default:
             return $this->getCustomTransactionOldValue($object, $xaction);
     }
 }