Skip to content

Commit bf744ca

Browse files
Merge pull request plesk#14 from vbaranovskiy-plesk/master
verify xml response and add id field for database server response of get operation
2 parents c7d0c16 + 95a6826 commit bf744ca

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

src/PleskX/Api/Client.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,7 @@ public function request($request, $mode = self::RESPONSE_SHORT)
142142
} else {
143143
$xml = $this->_performHttpRequest($request);
144144
}
145+
$this->_verifyResponse($xml);
145146

146147
return (self::RESPONSE_FULL == $mode) ? $xml : $xml->xpath('//result')[0];
147148
}
@@ -182,8 +183,6 @@ private function _performHttpRequest($request)
182183
curl_close($curl);
183184

184185
$xml = new XmlResponse($result);
185-
$this->_verifyResponse($xml);
186-
187186
return $xml;
188187
}
189188

src/PleskX/Api/Operator/DatabaseServer.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,9 @@ private function _get($field = null, $value = null)
5757

5858
$items = [];
5959
foreach ($response->xpath('//result') as $xmlResult) {
60-
$items[] = new Struct\Info($xmlResult->data);
60+
$item = new Struct\Info($xmlResult->data);
61+
$item->id = (int)$xmlResult->id;
62+
$items[] = $item;
6163
}
6264

6365
return $items;

0 commit comments

Comments
 (0)