diff --git a/src/Model/DbConnectedRestServiceModel.php b/src/Model/DbConnectedRestServiceModel.php index 5b07b9d1..959cc586 100644 --- a/src/Model/DbConnectedRestServiceModel.php +++ b/src/Model/DbConnectedRestServiceModel.php @@ -123,6 +123,14 @@ public function createService(DbConnectedRestServiceEntity $entity) public function updateService(DbConnectedRestServiceEntity $entity) { $updatedEntity = $this->restModel->updateService($entity); + + // We need the resource class in order to update db-connected config! + if (! $entity->resourceClass && $updatedEntity->resourceClass) { + $entity->exchangeArray(array( + 'resource_class' => $updatedEntity->resourceClass, + )); + } + $updatedProps = $this->updateDbConnectedConfig($entity); $updatedEntity->exchangeArray($updatedProps); $this->updateHalConfig($entity); diff --git a/src/Model/RestServiceModel.php b/src/Model/RestServiceModel.php index 01cc0a86..d744d832 100644 --- a/src/Model/RestServiceModel.php +++ b/src/Model/RestServiceModel.php @@ -320,7 +320,7 @@ public function updateService(RestServiceEntity $update) $controllerService = $update->controllerServiceName; try { - $original = $this->fetch($controllerService); + $original = $this->fetch($controllerService, false); } catch (Exception\RuntimeException $e) { throw new Exception\RuntimeException(sprintf( 'Cannot update REST service "%s"; not found', @@ -333,7 +333,7 @@ public function updateService(RestServiceEntity $update) $this->updateContentNegotiationConfig($original, $update); $this->updateHalConfig($original, $update); - return $this->fetch($controllerService); + return $this->fetch($controllerService, false); } /**