diff --git a/src/Rest/Base.php b/src/Rest/Base.php index 101000b1..821a0936 100644 --- a/src/Rest/Base.php +++ b/src/Rest/Base.php @@ -57,7 +57,13 @@ public function __construct(Session $session, array $fromData = null) } } - public function save($updateObject = false): void + /** + * @param bool $updateObject + * @return array|string|null + * @throws RestResourceRequestException + * @throws \JsonException + */ + public function save(bool $updateObject = false) { $data = self::dataDiff($this->toArray(true), $this->originalState); @@ -71,11 +77,18 @@ public function save($updateObject = false): void self::createInstance($body[$this->getJsonBodyName()], $this->session, $this); } + + return $response->getDecodedBody(); } - public function saveAndUpdate(): void + /** + * @return array|string|null + * @throws RestResourceRequestException + * @throws \JsonException + */ + public function saveAndUpdate() { - $this->save(true); + return $this->save(true); } public function __get(string $name)