Permalink
Browse files

modifed find for: URL/plural.xml?someparam=1

  • Loading branch information...
1 parent 33627ca commit 58eb8b28dbd0f7519d1635adea667095144346c6 @jhirbour jhirbour committed Feb 1, 2013
Showing with 25 additions and 3 deletions.
  1. +15 −0 examples/redmine.php
  2. +10 −3 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 {
+ 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);
+
+?>
@@ -250,8 +250,15 @@ public function find ($id = false, $options = array ()) {
if ($id == 'all') {
$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
+ if (! $id) {
+ return $this->_send_and_receive ($this->site . $this->element_name_plural . '.xml' . $options_string, 'GET');
+ }
+ else {
+ return $this->_send_and_receive ($this->site . $this->element_name_plural . '/' . $id . '.xml' . $options_string, 'GET');
+ }
}
/**
@@ -720,4 +727,4 @@ public function set ($k, $v = false) {
}
}
-?>
+?>

0 comments on commit 58eb8b2

Please sign in to comment.