-
Notifications
You must be signed in to change notification settings - Fork 180
Closed
Description
We have use some custom fields it redmine tasks for some projects, and I was needs to add this functionality in php-redmine-api quickly.
Probably you find this functionality is allowed to add for php-redmine-api. Of course in more presentable format. :)
My solution is next:
- in Redmine\Api\Issue class added this code in 'create' (and something like this in 'update') method:
... $params = $this->cleanParams($params); $params = array_filter(array_merge($defaults, $params)); $xml = new \SimpleXMLElement(''); foreach ($params as $k => $v) { // CUSTOMIZED: added custom fields if ($k == 'custom_fields' && is_array($v)) { $custom_fields_item = $xml->addChild('custom_fields', ''); $custom_fields_item->addAttribute('type', 'array'); foreach ($v as $field) { $item = $custom_fields_item->addChild('custom_field', ''); $item->addAttribute('id', $field['id']); $item->addChild('value', $field['value']); } } else { $item = $xml->addChild($k, $v); } } return $this->post('/issues.xml', $xml->asXML()); ...
Metadata
Metadata
Assignees
Labels
No labels