feat: lots more improvements
Signed-off-by: Sebastian Krupinski <krupinski01@gmail.com>
This commit is contained in:
@@ -247,17 +247,18 @@ class Manager {
|
||||
* @param string $userId User identifier for context
|
||||
* @param string $providerId Provider identifier
|
||||
* @param string|int $serviceId Service identifier
|
||||
* @param bool $delta Whether the update is a delta (partial) update or a full replacement
|
||||
* @param array $data Updated service configuration data
|
||||
*
|
||||
* @return ServiceBaseInterface Updated service
|
||||
*
|
||||
* @throws InvalidArgumentException If provider doesn't support service modification or service not found
|
||||
*/
|
||||
public function serviceUpdate(string $tenantId, string $userId, string $providerId, string|int $serviceId, array $data): ServiceBaseInterface {
|
||||
public function serviceUpdate(string $tenantId, string $userId, string $providerId, string|int $serviceId, bool $delta = false, array $data): ServiceBaseInterface {
|
||||
// retrieve provider and service
|
||||
$provider = $this->providerFetch($tenantId, $userId, $providerId);
|
||||
if ($provider instanceof ProviderServiceMutateInterface === false) {
|
||||
throw new InvalidArgumentException("Provider '$providerId' does not support service creation");
|
||||
throw new InvalidArgumentException("Provider '$providerId' does not support service modification");
|
||||
}
|
||||
|
||||
// Fetch existing service
|
||||
@@ -267,7 +268,7 @@ class Manager {
|
||||
}
|
||||
|
||||
// Update with new data
|
||||
$service->jsonDeserialize($data);
|
||||
$service->jsonDeserialize($data, $delta);
|
||||
|
||||
// Modify the service
|
||||
$provider->serviceModify($tenantId, $userId, $service);
|
||||
@@ -294,7 +295,7 @@ class Manager {
|
||||
// retrieve provider and service
|
||||
$provider = $this->providerFetch($tenantId, $userId, $providerId);
|
||||
if ($provider instanceof ProviderServiceMutateInterface === false) {
|
||||
throw new InvalidArgumentException("Provider '$providerId' does not support service creation");
|
||||
throw new InvalidArgumentException("Provider '$providerId' does not support service deletion");
|
||||
}
|
||||
|
||||
// Fetch existing service
|
||||
|
||||
Reference in New Issue
Block a user