/** * @task customfield */ private function getCustomFieldForTransaction(PhabricatorLiskDAO $object, PhabricatorApplicationTransaction $xaction) { $field_key = $xaction->getMetadataValue('customfield:key'); if (!$field_key) { throw new Exception("Custom field transaction has no 'customfield:key'!"); } $field = PhabricatorCustomField::getObjectField($object, PhabricatorCustomField::ROLE_APPLICATIONTRANSACTIONS, $field_key); if (!$field) { throw new Exception("Custom field transaction has invalid 'customfield:key'; field " . "'{$field_key}' is disabled or does not exist."); } if (!$field->shouldAppearInApplicationTransactions()) { throw new Exception("Custom field transaction '{$field_key}' does not implement " . "integration for ApplicationTransactions."); } $field->setViewer($this->getActor()); return $field; }
protected function getTransactionCustomField() { switch ($this->getTransactionType()) { case PhabricatorTransactions::TYPE_CUSTOMFIELD: $key = $this->getMetadataValue('customfield:key'); if (!$key) { return null; } $object = $this->getObject(); if (!$object instanceof PhabricatorCustomFieldInterface) { return null; } $field = PhabricatorCustomField::getObjectField($object, PhabricatorCustomField::ROLE_APPLICATIONTRANSACTIONS, $key); if (!$field) { return null; } $field->setViewer($this->getViewer()); return $field; } return null; }