本文整理匯總了PHP中Tracker_FormElementFactory::getUsedFieldByName方法的典型用法代碼示例。如果您正苦於以下問題:PHP Tracker_FormElementFactory::getUsedFieldByName方法的具體用法?PHP Tracker_FormElementFactory::getUsedFieldByName怎麽用?PHP Tracker_FormElementFactory::getUsedFieldByName使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Tracker_FormElementFactory
的用法示例。
在下文中一共展示了Tracker_FormElementFactory::getUsedFieldByName方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: getFieldByName
private function getFieldByName(Tracker $tracker, $field_name)
{
$field = $this->formelement_factory->getUsedFieldByName($tracker->getId(), $field_name);
if (!$field) {
throw new Tracker_FormElement_InvalidFieldException("Field {$field_name} does not exist in the tracker");
}
return $field;
}
示例2: getArtifactDataFromSoapRequest
private function getArtifactDataFromSoapRequest(Tracker $tracker, $values, Tracker_Artifact $artifact = null)
{
$fields_data = array();
foreach ($values as $field_value) {
// field are identified by name, we need to retrieve the field id
if ($field_value->field_name) {
$field = $this->formelement_factory->getUsedFieldByName($tracker->getId(), $field_value->field_name);
if ($field) {
$field_data = $field->getFieldDataFromSoapValue($field_value, $artifact);
if ($field_data !== null) {
// $field_value is an object: SOAP must cast it in ArtifactFieldValue
if (isset($fields_data[$field->getId()])) {
if (!is_array($fields_data[$field->getId()])) {
$fields_data[$field->getId()] = array($fields_data[$field->getId()]);
}
$fields_data[$field->getId()][] = $field_data;
} else {
$fields_data[$field->getId()] = $field_data;
}
} else {
throw new SoapFault(update_artifact_fault, 'Unknown value ' . print_r($field_value->field_value, true) . ' for field: ' . $field_value->field_name);
}
} else {
throw new SoapFault(update_artifact_fault, 'Unknown field: ' . $field_value->field_name);
}
}
}
return $fields_data;
}
示例3: getFieldsData
/**
* @return array
*/
public function getFieldsData(SimpleXMLElement $xml_field_change)
{
$data = array();
if (!$xml_field_change->field_change) {
return $data;
}
foreach ($xml_field_change->field_change as $field_change) {
$field = $this->formelement_factory->getUsedFieldByName($this->tracker->getId(), (string) $field_change['field_name']);
if ($field) {
$this->appendValidValue($data, $field, $field_change);
} else {
$this->logger->debug("Skipped unknown/unused field " . (string) $field_change['field_name']);
}
}
return $data;
}