Skip to content

Commit

Permalink
refactor: ISAMS requires the whole lot of data to be present otherwis…
Browse files Browse the repository at this point in the history
…e it assume it is null. So we get the curent data, and `array_merge` it with our new stuff
  • Loading branch information
fredbradley committed Dec 16, 2021
1 parent ddfd635 commit 9a79f96
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/Controllers/HumanResourcesEmployeeController.php
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,10 @@ public function update(int $id, array $attributes): JsonResponse
'surname',
], $attributes);

$currentData = (array) $this->show($id);

$attributes = array_merge($currentData, $attributes);

$response = $this->guzzle->request('PUT', $this->endpoint . '/' . $id, [
'headers' => $this->getHeaders(),
'json' => $attributes,
Expand Down
17 changes: 17 additions & 0 deletions src/Exceptions/ProfessionNotPresent.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<?php

namespace spkm\isams\Exceptions;

use Throwable;

class ProfessionNotPresent extends \Exception
{
public function __construct($message = "", $code = 0, Throwable $previous = null)
{
if (str_contains($message, "is not present in the profession types list.")) {

}
parent::__construct($message, $code, $previous);
}

}

0 comments on commit 9a79f96

Please sign in to comment.