[ Index ] |
PHP Cross Reference of Phabricator |
[Summary view] [Print] [Text view]
1 <?php 2 3 final class PhragmentSnapshot extends PhragmentDAO 4 implements PhabricatorPolicyInterface { 5 6 protected $primaryFragmentPHID; 7 protected $name; 8 9 private $primaryFragment = self::ATTACHABLE; 10 11 public function getConfiguration() { 12 return array( 13 self::CONFIG_AUX_PHID => true, 14 self::CONFIG_COLUMN_SCHEMA => array( 15 'name' => 'text128', 16 ), 17 self::CONFIG_KEY_SCHEMA => array( 18 'key_name' => array( 19 'columns' => array('primaryFragmentPHID', 'name'), 20 'unique' => true, 21 ), 22 ), 23 ) + parent::getConfiguration(); 24 } 25 26 public function generatePHID() { 27 return PhabricatorPHID::generateNewPHID( 28 PhragmentSnapshotPHIDType::TYPECONST); 29 } 30 31 public function getURI() { 32 return '/phragment/snapshot/view/'.$this->getID().'/'; 33 } 34 35 public function getPrimaryFragment() { 36 return $this->assertAttached($this->primaryFragment); 37 } 38 39 public function attachPrimaryFragment(PhragmentFragment $fragment) { 40 return $this->primaryFragment = $fragment; 41 } 42 43 public function delete() { 44 $children = id(new PhragmentSnapshotChild()) 45 ->loadAllWhere('snapshotPHID = %s', $this->getPHID()); 46 $this->openTransaction(); 47 foreach ($children as $child) { 48 $child->delete(); 49 } 50 $result = parent::delete(); 51 $this->saveTransaction(); 52 return $result; 53 } 54 55 56 /* -( Policy Interface )--------------------------------------------------- */ 57 58 59 public function getCapabilities() { 60 return $this->getPrimaryFragment()->getCapabilities(); 61 } 62 63 public function getPolicy($capability) { 64 return $this->getPrimaryFragment()->getPolicy($capability); 65 } 66 67 public function hasAutomaticCapability($capability, PhabricatorUser $viewer) { 68 return $this->getPrimaryFragment() 69 ->hasAutomaticCapability($capability, $viewer); 70 } 71 72 public function describeAutomaticCapability($capability) { 73 return $this->getPrimaryFragment() 74 ->describeAutomaticCapability($capability); 75 } 76 }
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 |