|
@@ -27,6 +27,22 @@ class Webservice
|
|
public function getChoices($webservice, $params = array())
|
|
public function getChoices($webservice, $params = array())
|
|
{
|
|
{
|
|
$choices = array();
|
|
$choices = array();
|
|
|
|
+ $objectsJson = $this->getArray($webservice, $params);
|
|
|
|
+ foreach ($objectsJson as $object) {
|
|
|
|
+ $choices[$object['name']] = $object['id'];
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ return $choices;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * @param string $webservice
|
|
|
|
+ * @param array $params
|
|
|
|
+ * @return array
|
|
|
|
+ */
|
|
|
|
+ public function getArray($webservice, $params = array())
|
|
|
|
+ {
|
|
|
|
+ $objectsJson = array();
|
|
if ($this->serviceContainer->hasParameter($webservice)) {
|
|
if ($this->serviceContainer->hasParameter($webservice)) {
|
|
$url = $this->serviceContainer->getParameter($webservice);
|
|
$url = $this->serviceContainer->getParameter($webservice);
|
|
$url .= '?filters[qb-criteria]';
|
|
$url .= '?filters[qb-criteria]';
|
|
@@ -34,12 +50,9 @@ class Webservice
|
|
$url .= "&filters[{$param}]=$value";
|
|
$url .= "&filters[{$param}]=$value";
|
|
}
|
|
}
|
|
$objectsJson = json_decode(file_get_contents($url), true);
|
|
$objectsJson = json_decode(file_get_contents($url), true);
|
|
- foreach ($objectsJson as $object) {
|
|
|
|
- $choices[$object['name']] = $object['id'];
|
|
|
|
- }
|
|
|
|
}
|
|
}
|
|
-
|
|
|
|
- return $choices;
|
|
|
|
|
|
+
|
|
|
|
+ return $objectsJson;
|
|
}
|
|
}
|
|
|
|
|
|
}
|
|
}
|