[ Index ] |
PHP Cross Reference of Phabricator |
[Summary view] [Print] [Text view]
1 <?php 2 3 final class AlmanacCoreCustomField 4 extends AlmanacCustomField 5 implements PhabricatorStandardCustomFieldInterface { 6 7 public function getStandardCustomFieldNamespace() { 8 return 'almanac:core'; 9 } 10 11 public function createFields($object) { 12 $specs = array(); 13 14 foreach ($object->getAlmanacProperties() as $property) { 15 $specs[$property->getFieldName()] = array( 16 'name' => $property->getFieldName(), 17 'type' => 'text', 18 ); 19 } 20 21 return PhabricatorStandardCustomField::buildStandardFields($this, $specs); 22 } 23 24 public function shouldUseStorage() { 25 return false; 26 } 27 28 public function readValueFromObject(PhabricatorCustomFieldInterface $object) { 29 $key = $this->getProxy()->getRawStandardFieldKey(); 30 $this->setValueFromStorage($object->getAlmanacPropertyValue($key)); 31 } 32 33 public function applyApplicationTransactionInternalEffects( 34 PhabricatorApplicationTransaction $xaction) { 35 return; 36 } 37 38 public function applyApplicationTransactionExternalEffects( 39 PhabricatorApplicationTransaction $xaction) { 40 41 $object = $this->getObject(); 42 $phid = $object->getPHID(); 43 $key = $this->getProxy()->getRawStandardFieldKey(); 44 45 $property = id(new AlmanacPropertyQuery()) 46 ->setViewer($this->getViewer()) 47 ->withObjectPHIDs(array($phid)) 48 ->withNames(array($key)) 49 ->executeOne(); 50 if (!$property) { 51 $property = id(new AlmanacProperty()) 52 ->setObjectPHID($phid) 53 ->setFieldIndex(PhabricatorHash::digestForIndex($key)) 54 ->setFieldName($key); 55 } 56 57 $property 58 ->setFieldValue($xaction->getNewValue()) 59 ->save(); 60 } 61 62 }
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 |