使用Redmine的PHP API时,如何判断需求是否为原子需求
2016-08-29 14:44
706 查看
使用Redmine的PHP API时,如何判断需求是否为原子需求
使用redmine的PHP接口时,怎样才能判断需求是否为原子需求呢,下面给出具体的做法:/** * 判断是否为原子需求, 即是否依然含有子需求 * @param int $id 需求Id * @return int */ public function hasChildIssue($id) { $res = $this->client->api('issue')->show($id, array('include' => 'children')); if (!empty($res) && isset($res['issue']['children'])) { return true; } return false; }
set_time_limit(0); $startTime = microtime(true); //检查API KEY是否配置 $configService = $this->serviceInstance('config', 'work'); $config = $configService->getConstApiKey(); if (empty($config)) { throw new \Exception('固定API KEY未配置'); } $constApiKey = $config['value']; $redmine = new RedmineLib($constApiKey); $issueId=17252; $temp = $redmine->client->get('/issues/'.urlencode($issueId).'.json?'.http_build_query(array ('include' => 'children'))); $temp = $redmine->client->api('issue')->show(17252, array ('include' => 'children')); var_dump($temp['issue']['children']); exit; // 如果有子任务,['issue']['children']字段不存在,否则['issue']['children']字段对应一个子数组 // $temp = $redmine->client->issue->show(17252, array('include' => 'children')); // $temp = $redmine->hasChildIssue(17330); var_dump($temp); exit;
相关链接:
http://www.redmine.org/projects/redmine/wiki/Rest_Issues
Rest api with php - Redmine
http://www.redmine.org/projects/redmine/wiki/Rest_api_with_php
相关文章推荐
- 如何使用php判断服务器是否是HTTPS连接
- php使用DOMDocument的时候如何判断xml中某节点是否存在
- 如何使用php判断服务器是否是HTTPS连接
- 如何使用php判断服务器是否是HTTPS连接
- 如何使用DOS命令判断磁盘分区是否为NTFS格式
- 使用API判断网络是否连通(InternetGetConnectedState / IsNetworkAlive)
- 使用API判断网络是否连通(InternetGetConnectedState / IsNetworkAlive)
- 如何判断手机是否在使用3G网络
- 如何在PHP中判断某个函数是否被支持
- 如何用PHP判断数据库中的记录是否存在
- PHP如何判断远程文件是否存在
- php如何判断文件是否存在,包括本地和远程文件
- 使用API判断网络是否连通(InternetGetConnectedState / IsNetworkAlive)
- jQuery -- 如何使用jQuery判断某个元素是否存在
- 如何判断标准输入或输出是否经过了重定向,即是否在命令行上使用了“”?
- PHP判断键值数组是否存在,使用empty或isset或array_key_exists
- 如何判断标准输入或输出是否经过了重定向,即是否在命令行上使用了“”?
- linux api笔记(2) 网络编程(一)如何判断非阻塞套接字是否连接成功
- 使用API判断网络是否连通(InternetGetConnectedState / IsNetworkAlive)
- PHP判断客户端是否使用代理服务器及其匿名级别