0
내가 사용 API는 여기에 있습니다 :- 레드 마인
http://www.redmine.org/projects/redmine/wiki/Rest_api_with_php
코드 : (사용할 수없는 링크 경우)
<?php
require_once ('ActiveResource.php');
class Issue extends ActiveResource {
var $site = 'http://username:[email protected]:3000/';
var $request_format = 'xml'; // REQUIRED!
}
// create a new issue
$issue = new Issue (array ('subject' => 'XML REST API', 'project_id' => '1'));
$issue->save();
echo $issue->id;
// find issues
$issues = $issue->find ('all');
for ($i=0; $i < count($issues); $i++) {
echo $issues[$i]->subject;
}
// find and update an issue
$issue->find (1);
echo $issue->subject;
$issue->set ('subject', 'This is the new subject')->save();
// update status
$issue->set ('status_id', 2)->save();
// delete an issue
$issue->find (1);
$issue->destroy();
?>
나는이 API를 사용하려고 해요 Redmine 데이터베이스에 액세스하고 아무에게도 할당되지 않은 문제를 얻을 수 있습니다.
다음은 ActiveResource.php 사용법에서 볼 수있는 것처럼 사용자 지정 메서드의 예입니다. 마지막으로
// custom method
$songs = $song->get ('by_year', array ('year' => 1999));
, 내 코드 :
require_once ('ActiveResource.php');
class Issue extends ActiveResource {
var $site = 'root:[email protected]/redmine';
var $request_format = 'xml'; // REQUIRED!
var $element_name = 'issue'
}
$issue = new Issue();
$issues = $issue->find('all'); //Works fine
print_r($issues);
문제 : assigned_to_id가 null 인 것을 나는 그래서이의
$issues = $issue->find ("all", array('assigned_to_id'=>null)); //not working
$issues = $issue->find (false, array('assigned_to_id'=>null)); //not working
$issues = $issue->get ('by_assigned_to_id', array('assigned_to_id' => null)) //not working
없음을 시도하지 만 문제를 얻으려면
일하고있다, 잘못되었거나 내가 무엇을 놓쳤는가?
더 많은 참조 : http://www.redmine.org/projects/redmine/wiki/Rest_Issues
그건 해결책이 아니지만 도움 주셔서 감사합니다. 여기서 문제는 데이터베이스에서 필드가 null이기 때문에 메소드 find가 실행될 때 xml의 태그이 생성되지 않는다는 것입니다. ActiveResource.php에서 변경하려고했지만 어디에서 변경해야하는지 찾지 못했습니다. 그래서 find ('all')를 호출하고 모든 이슈를 반복합니다. assigned_to가 설정되어 있지 않으면 원하는 것입니다. 최고의 솔루션은 아니지만 괜찮습니다. 작동합니다 ... –
gbvisconti