Changeset View
Changeset View
Standalone View
Standalone View
src/applications/differential/storage/DifferentialRevision.php
Show All 35 Lines | final class DifferentialRevision extends DifferentialDAO | ||||
protected $branchName; | protected $branchName; | ||||
protected $repositoryPHID; | protected $repositoryPHID; | ||||
protected $activeDiffPHID; | protected $activeDiffPHID; | ||||
protected $viewPolicy = PhabricatorPolicies::POLICY_USER; | protected $viewPolicy = PhabricatorPolicies::POLICY_USER; | ||||
protected $editPolicy = PhabricatorPolicies::POLICY_USER; | protected $editPolicy = PhabricatorPolicies::POLICY_USER; | ||||
protected $properties = array(); | protected $properties = array(); | ||||
private $commits = self::ATTACHABLE; | private $commitPHIDs = self::ATTACHABLE; | ||||
private $activeDiff = self::ATTACHABLE; | private $activeDiff = self::ATTACHABLE; | ||||
private $diffIDs = self::ATTACHABLE; | private $diffIDs = self::ATTACHABLE; | ||||
private $hashes = self::ATTACHABLE; | private $hashes = self::ATTACHABLE; | ||||
private $repository = self::ATTACHABLE; | private $repository = self::ATTACHABLE; | ||||
private $reviewerStatus = self::ATTACHABLE; | private $reviewerStatus = self::ATTACHABLE; | ||||
private $customFields = self::ATTACHABLE; | private $customFields = self::ATTACHABLE; | ||||
private $drafts = array(); | private $drafts = array(); | ||||
▲ Show 20 Lines • Show All 100 Lines • ▼ Show 20 Lines | public function getMonogram() { | ||||
$id = $this->getID(); | $id = $this->getID(); | ||||
return "D{$id}"; | return "D{$id}"; | ||||
} | } | ||||
public function getURI() { | public function getURI() { | ||||
return '/'.$this->getMonogram(); | return '/'.$this->getMonogram(); | ||||
} | } | ||||
public function loadCommitPHIDs() { | |||||
if (!$this->getID()) { | |||||
return ($this->commits = array()); | |||||
} | |||||
$commits = queryfx_all( | |||||
$this->establishConnection('r'), | |||||
'SELECT commitPHID FROM %T WHERE revisionID = %d', | |||||
self::TABLE_COMMIT, | |||||
$this->getID()); | |||||
$commits = ipull($commits, 'commitPHID'); | |||||
return ($this->commits = $commits); | |||||
} | |||||
public function getCommitPHIDs() { | public function getCommitPHIDs() { | ||||
return $this->assertAttached($this->commits); | return $this->assertAttached($this->commitPHIDs); | ||||
} | } | ||||
public function getActiveDiff() { | public function getActiveDiff() { | ||||
// TODO: Because it's currently technically possible to create a revision | // TODO: Because it's currently technically possible to create a revision | ||||
// without an associated diff, we allow an attached-but-null active diff. | // without an associated diff, we allow an attached-but-null active diff. | ||||
// It would be good to get rid of this once we make diff-attaching | // It would be good to get rid of this once we make diff-attaching | ||||
// transactional. | // transactional. | ||||
Show All 11 Lines | final class DifferentialRevision extends DifferentialDAO | ||||
public function attachDiffIDs(array $ids) { | public function attachDiffIDs(array $ids) { | ||||
rsort($ids); | rsort($ids); | ||||
$this->diffIDs = array_values($ids); | $this->diffIDs = array_values($ids); | ||||
return $this; | return $this; | ||||
} | } | ||||
public function attachCommitPHIDs(array $phids) { | public function attachCommitPHIDs(array $phids) { | ||||
$this->commits = array_values($phids); | $this->commitPHIDs = $phids; | ||||
return $this; | return $this; | ||||
} | } | ||||
public function getAttachedPHIDs($type) { | public function getAttachedPHIDs($type) { | ||||
return array_keys(idx($this->attached, $type, array())); | return array_keys(idx($this->attached, $type, array())); | ||||
} | } | ||||
public function setAttachedPHIDs($type, array $phids) { | public function setAttachedPHIDs($type, array $phids) { | ||||
▲ Show 20 Lines • Show All 958 Lines • Show Last 20 Lines |