[ Index ]

PHP Cross Reference of Phabricator

title

Body

[close]

/src/applications/phragment/storage/ -> PhragmentFragmentVersion.php (source)

   1  <?php
   2  
   3  final class PhragmentFragmentVersion extends PhragmentDAO
   4    implements PhabricatorPolicyInterface {
   5  
   6    protected $sequence;
   7    protected $fragmentPHID;
   8    protected $filePHID;
   9  
  10    private $fragment = self::ATTACHABLE;
  11    private $file = self::ATTACHABLE;
  12  
  13    public function getConfiguration() {
  14      return array(
  15        self::CONFIG_AUX_PHID => true,
  16        self::CONFIG_COLUMN_SCHEMA => array(
  17          'sequence' => 'uint32',
  18          'filePHID' => 'phid?',
  19        ),
  20        self::CONFIG_KEY_SCHEMA => array(
  21          'key_version' => array(
  22            'columns' => array('fragmentPHID', 'sequence'),
  23            'unique' => true,
  24          ),
  25        ),
  26      ) + parent::getConfiguration();
  27    }
  28  
  29    public function generatePHID() {
  30      return PhabricatorPHID::generateNewPHID(
  31        PhragmentFragmentVersionPHIDType::TYPECONST);
  32    }
  33  
  34    public function getURI() {
  35      return '/phragment/version/'.$this->getID().'/';
  36    }
  37  
  38    public function getFragment() {
  39      return $this->assertAttached($this->fragment);
  40    }
  41  
  42    public function attachFragment(PhragmentFragment $fragment) {
  43      return $this->fragment = $fragment;
  44    }
  45  
  46    public function getFile() {
  47      return $this->assertAttached($this->file);
  48    }
  49  
  50    public function attachFile(PhabricatorFile $file) {
  51      return $this->file = $file;
  52    }
  53  
  54    public function getCapabilities() {
  55      return array(
  56        PhabricatorPolicyCapability::CAN_VIEW,
  57      );
  58    }
  59  
  60    public function getPolicy($capability) {
  61      return $this->getFragment()->getPolicy($capability);
  62    }
  63  
  64    public function hasAutomaticCapability($capability, PhabricatorUser $viewer) {
  65      return $this->getFragment()->hasAutomaticCapability($capability, $viewer);
  66    }
  67  
  68    public function describeAutomaticCapability($capability) {
  69      return $this->getFragment()->describeAutomaticCapability($capability);
  70    }
  71  
  72  }


Generated: Sun Nov 30 09:20:46 2014 Cross-referenced by PHPXref 0.7.1