Exemplo n.º 1
0
 public static function newPropertyRemoveTransactions(AlmanacPropertyInterface $object, array $properties)
 {
     $template = $object->getApplicationTransactionTemplate();
     $xactions = array();
     foreach ($properties as $property) {
         $xactions[] = id(clone $template)->setTransactionType(AlmanacTransaction::TYPE_PROPERTY_REMOVE)->setMetadataValue('almanac.property', $property)->setNewValue(null);
     }
     return $xactions;
 }
Exemplo n.º 2
0
 public static function buildTransactions(AlmanacPropertyInterface $object, array $properties)
 {
     $template = $object->getApplicationTransactionTemplate();
     $attached_properties = $object->getAlmanacProperties();
     foreach ($properties as $key => $value) {
         if (empty($attached_properties[$key])) {
             $attached_properties[] = id(new AlmanacProperty())->setObjectPHID($object->getPHID())->setFieldName($key);
         }
     }
     $object->attachAlmanacProperties($attached_properties);
     $field_list = PhabricatorCustomField::getObjectFields($object, PhabricatorCustomField::ROLE_DEFAULT);
     $fields = $field_list->getFields();
     $xactions = array();
     foreach ($properties as $name => $property) {
         $xactions[] = id(clone $template)->setTransactionType(PhabricatorTransactions::TYPE_CUSTOMFIELD)->setMetadataValue('customfield:key', $name)->setOldValue($object->getAlmanacPropertyValue($name))->setNewValue($property);
     }
     return $xactions;
 }