Permalink
Browse files

Merge pull request #22 from primetimesolutions/fix_find_for_redmine

modifed find for: URL/plural.xml?someparam=1
  • Loading branch information...
2 parents 33627ca + 3e40213 commit e5efb70fa3b5d08b440a4d4ad5257e2afb4ff9dd @jbroadway committed Feb 1, 2013
Showing with 21 additions and 4 deletions.
  1. +15 −0 examples/redmine.php
  2. +6 −4 lib/ActiveResource/ActiveResource.php
View
@@ -0,0 +1,15 @@
+#!/usr/bin/env php
+<?php
+// see http://www.redmine.org/projects/redmine/wiki/Rest_Issues for API reference
+
+require_once ('ActiveResource.php');
+class RmIssue extends ActiveResource\ActiveResource {
+ var $site = 'http://127.0.0.1:3000/';
+ var $element_name = 'issue';
+}
+// get all issues assigned to a person
+$issues = new RmIssue();
+$issues = $issues->find(false, array('assigned_to' => 'Redmine Admin'));
+print_r($issues);
+
+?>
@@ -247,11 +247,13 @@ public function find ($id = false, $options = array ()) {
if (count ($options) > 0) {
$options_string = '?' . http_build_query ($options);
}
- if ($id == 'all') {
+ if ($id == 'all' || $id == false) {
$url = $this->site . $this->element_name_plural . '.xml';
return $this->_send_and_receive ($url . $options_string, 'GET');
- }
- return $this->_send_and_receive ($this->site . $this->element_name_plural . '/' . $id . '.xml' . $options_string, 'GET');
+ }
+
+ // URL/plural.xml?someparam=1
+ return $this->_send_and_receive ($this->site . $this->element_name_plural . '/' . $id . '.xml' . $options_string, 'GET');
}
/**
@@ -720,4 +722,4 @@ public function set ($k, $v = false) {
}
}
-?>
+?>

0 comments on commit e5efb70

Please sign in to comment.