本文整理汇总了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;
}