3 final class PhragmentFragmentVersion
extends PhragmentDAO
4 implements PhabricatorPolicyInterface
{
7 protected $fragmentPHID;
10 private $fragment = self
::ATTACHABLE
;
11 private $file = self
::ATTACHABLE
;
13 protected function getConfiguration() {
15 self
::CONFIG_AUX_PHID
=> true,
16 self
::CONFIG_COLUMN_SCHEMA
=> array(
17 'sequence' => 'uint32',
18 'filePHID' => 'phid?',
20 self
::CONFIG_KEY_SCHEMA
=> array(
21 'key_version' => array(
22 'columns' => array('fragmentPHID', 'sequence'),
26 ) + parent
::getConfiguration();
29 public function generatePHID() {
30 return PhabricatorPHID
::generateNewPHID(
31 PhragmentFragmentVersionPHIDType
::TYPECONST
);
34 public function getURI() {
35 return '/phragment/version/'.$this->getID().'/';
38 public function getFragment() {
39 return $this->assertAttached($this->fragment
);
42 public function attachFragment(PhragmentFragment
$fragment) {
43 return $this->fragment
= $fragment;
46 public function getFile() {
47 return $this->assertAttached($this->file
);
50 public function attachFile(PhabricatorFile
$file) {
51 return $this->file
= $file;
54 public function getCapabilities() {
56 PhabricatorPolicyCapability
::CAN_VIEW
,
60 public function getPolicy($capability) {
61 return $this->getFragment()->getPolicy($capability);
64 public function hasAutomaticCapability($capability, PhabricatorUser
$viewer) {
65 return $this->getFragment()->hasAutomaticCapability($capability, $viewer);
68 public function describeAutomaticCapability($capability) {
69 return $this->getFragment()->describeAutomaticCapability($capability);