[ Index ] |
PHP Cross Reference of Phabricator |
[Summary view] [Print] [Text view]
1 <?php 2 3 final class PhragmentSnapshotChild extends PhragmentDAO 4 implements PhabricatorPolicyInterface { 5 6 protected $snapshotPHID; 7 protected $fragmentPHID; 8 protected $fragmentVersionPHID; 9 10 private $snapshot = self::ATTACHABLE; 11 private $fragment = self::ATTACHABLE; 12 private $fragmentVersion = self::ATTACHABLE; 13 14 public function getConfiguration() { 15 return array( 16 self::CONFIG_COLUMN_SCHEMA => array( 17 'fragmentVersionPHID' => 'phid?', 18 ), 19 self::CONFIG_KEY_SCHEMA => array( 20 'key_child' => array( 21 'columns' => array( 22 'snapshotPHID', 23 'fragmentPHID', 24 'fragmentVersionPHID', 25 ), 26 'unique' => true, 27 ), 28 ), 29 ) + parent::getConfiguration(); 30 } 31 32 public function getSnapshot() { 33 return $this->assertAttached($this->snapshot); 34 } 35 36 public function attachSnapshot(PhragmentSnapshot $snapshot) { 37 return $this->snapshot = $snapshot; 38 } 39 40 public function getFragment() { 41 return $this->assertAttached($this->fragment); 42 } 43 44 public function attachFragment(PhragmentFragment $fragment) { 45 return $this->fragment = $fragment; 46 } 47 48 public function getFragmentVersion() { 49 if ($this->fragmentVersionPHID === null) { 50 return null; 51 } 52 return $this->assertAttached($this->fragmentVersion); 53 } 54 55 public function attachFragmentVersion(PhragmentFragmentVersion $version) { 56 return $this->fragmentVersion = $version; 57 } 58 59 60 /* -( Policy Interface )--------------------------------------------------- */ 61 62 63 public function getCapabilities() { 64 return array( 65 PhabricatorPolicyCapability::CAN_VIEW, 66 ); 67 } 68 69 public function getPolicy($capability) { 70 return $this->getSnapshot()->getPolicy($capability); 71 } 72 73 public function hasAutomaticCapability($capability, PhabricatorUser $viewer) { 74 return $this->getSnapshot() 75 ->hasAutomaticCapability($capability, $viewer); 76 } 77 78 public function describeAutomaticCapability($capability) { 79 return $this->getSnapshot() 80 ->describeAutomaticCapability($capability); 81 } 82 }
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
Generated: Sun Nov 30 09:20:46 2014 | Cross-referenced by PHPXref 0.7.1 |