Skip to content

Commit a5e6e7c

Browse files
author
steve
committed
Fixed site generalInfo object to provide site-id, which allows me to use it to create site-aliases. Then fixed the siteAlias object so that it is more flexible
1 parent f88b7d0 commit a5e6e7c

File tree

2 files changed

+14
-2
lines changed

2 files changed

+14
-2
lines changed

src/PleskX/Api/Operator/SiteAlias.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,10 @@ public function create(array $properties, array $preferences = [])
2525
}
2626
}
2727

28-
$info->addChild('site-id', $properties['site-id']);
29-
$info->addChild('name', $properties['name']);
28+
foreach($properties as $key => $val)
29+
{
30+
$info->addChild($key,$val);
31+
}
3032

3133
$response = $this->_client->request($packet);
3234
return new Struct\Info($response);

src/PleskX/Api/Struct/Site/GeneralInfo.php

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@
55

66
class GeneralInfo extends \PleskX\Api\Struct
77
{
8+
/** @var string */
9+
public $id;
10+
811
/** @var string */
912
public $name;
1013

@@ -17,6 +20,8 @@ class GeneralInfo extends \PleskX\Api\Struct
1720
/** @var string */
1821
public $description;
1922

23+
24+
2025
public function __construct($apiResponse)
2126
{
2227
$this->_initScalarProperties($apiResponse, [
@@ -25,5 +30,10 @@ public function __construct($apiResponse)
2530
'guid',
2631
'description',
2732
]);
33+
34+
$encoded = json_encode($apiResponse);
35+
$decoded = json_decode($encoded);
36+
37+
$this->id = $decoded->{'webspace-id'};
2838
}
2939
}

0 commit comments

Comments
 (0)