本文整理匯總了PHP中PhabricatorCustomField::getObjectField方法的典型用法代碼示例。如果您正苦於以下問題:PHP PhabricatorCustomField::getObjectField方法的具體用法?PHP PhabricatorCustomField::getObjectField怎麽用?PHP PhabricatorCustomField::getObjectField使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類PhabricatorCustomField
的用法示例。
在下文中一共展示了PhabricatorCustomField::getObjectField方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: getCustomFieldForTransaction
/**
* @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;
}
示例2: getTransactionCustomField
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;
}