From c396a9abda827d1fcb682c5f45056063985e84d5 Mon Sep 17 00:00:00 2001 From: Hirenkumar Parmar Date: Fri, 10 Mar 2023 14:43:56 +0000 Subject: [PATCH] Throw exception in setInitialApiProducts for edit --- src/Api/Management/Entity/App.php | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/Api/Management/Entity/App.php b/src/Api/Management/Entity/App.php index 914dd56a..eeb6c43c 100644 --- a/src/Api/Management/Entity/App.php +++ b/src/Api/Management/Entity/App.php @@ -229,12 +229,19 @@ public function getApiProducts(): array } /** - * Set Initial API Product while creating App. + * Set Initial API Product while creating App only. + * The method is not supported to update existing App. * * @param array $initialApiProducts + * + * @throws \Exception If used to update existing App. */ public function setInitialApiProducts(array $initialApiProducts): void { - $this->initialApiProducts = $initialApiProducts; + if (!$this->appId) { + $this->initialApiProducts = $initialApiProducts; + } else { + throw new \Exception('This method is not supported to update existing App.'); + } } }