Permalink
Browse files

get method should check for results, not records

  • Loading branch information...
1 parent 14fd1c8 commit c686db46cc9022be8577bda44f6b80aa551c1010 @filiptepper filiptepper committed Sep 6, 2011
Showing with 9 additions and 10 deletions.
  1. +9 −10 sugar_rest.php
View
@@ -311,17 +311,16 @@ public function get_with_related($module,$fields,$options=null) {
public function get($module,$fields,$options=null) {
$results = $this->get_with_related($module,array($module => $fields),$options);
$records = array();
- if ($records)
- {
- foreach($results['entry_list'] as $entry) {
- $record = array();
- foreach($entry['name_value_list'] as $field) {
- $record[$field['name']] = $field['value'];
+ if ($results) {
+ foreach($results['entry_list'] as $entry) {
+ $record = array();
+ foreach($entry['name_value_list'] as $field) {
+ $record[$field['name']] = $field['value'];
+ }
+ $records[] = $record;
}
- $records[] = $record;
}
- }
- return $records;
+ return $records;
}
/**
@@ -453,4 +452,4 @@ function __destruct() {
}
}
-?>
+?>

0 comments on commit c686db4

Please sign in to comment.