|
@@ -21,9 +21,9 @@ class Webservice
|
|
|
public function getChoices($webservice, $params = array())
|
|
|
{
|
|
|
$choices = array();
|
|
|
- $objectsJson = $this->getArray($webservice, $params);
|
|
|
- foreach ($objectsJson as $object) {
|
|
|
- $choices[$object['name']] = $object['id'];
|
|
|
+ $results = $this->getArray($webservice, $params);
|
|
|
+ foreach ($results as $row) {
|
|
|
+ $choices[$row['name']] = $row['id'];
|
|
|
}
|
|
|
|
|
|
return $choices;
|
|
@@ -36,7 +36,7 @@ class Webservice
|
|
|
*/
|
|
|
public function getArray($webservice, $params = array())
|
|
|
{
|
|
|
- $objectsJson = array();
|
|
|
+ $results = array();
|
|
|
if ($this->serviceContainer->hasParameter($webservice)) {
|
|
|
$url = $this->serviceContainer->getParameter($webservice);
|
|
|
$url .= '?filters[qb-criteria]';
|
|
@@ -44,13 +44,13 @@ class Webservice
|
|
|
$url .= "&filters[{$param}]=$value";
|
|
|
}
|
|
|
try {
|
|
|
- $objectsJson = json_decode(file_get_contents($url), true);
|
|
|
+ $results = json_decode(file_get_contents($url), true);
|
|
|
} catch (\Exception $ex) {
|
|
|
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- return $objectsJson;
|
|
|
+ return $results;
|
|
|
}
|
|
|
|
|
|
/**
|