Skip to content

Commit

Permalink
Added function for updating taak with zaak
Browse files Browse the repository at this point in the history
  • Loading branch information
bbrands02 committed Oct 8, 2024
1 parent 8a0cf64 commit bcd9a5b
Showing 1 changed file with 29 additions and 1 deletion.
30 changes: 29 additions & 1 deletion src/Service/ZaakService.php
Original file line number Diff line number Diff line change
Expand Up @@ -463,6 +463,29 @@ public function getZaak(array $configuration, string $caseID)

}//end getZaak()

/**
* Updates the taak with the zaak url.
*
* @param ObjectEntity $zaak The zaak object.
* @param string $taakId The taak id.
*
* @return ObjectEntity The updated taak object.
*/
private function updateTaak(ObjectEntity $zaak, string $taakId): ObjectEntity
{
$this->logger->info("taakId found in body, trying to update taak with zaak url");

$zaak = $this->resourceService->getObject($zaak->getId()->toString(), 'common-gateway/xxllnc-zgw-bundle');
$taak = $this->resourceService->getObject($taakId, 'common-gateway/xxllnc-zgw-bundle');
$taak->setValue('url', $zaak->getValue('url'));
$this->entityManager->persist($taak);
$this->entityManager->flush();

$this->logger->info("Updated taak with zaak url");

return $taak;
}//end updateTaak()


/**
* Creates or updates a ZGW Zaak from a xxllnc case with the use of mapping.
Expand All @@ -483,11 +506,16 @@ public function zaakHandler(?array $data = [], ?array $configuration = [])

if (isset($data['caseId']) === true) {
$this->getZaak($configuration, $data['caseId']);

return $data;
}

if (isset($data['body']['case_uuid']) === true) {
$this->getZaak($configuration, $data['body']['case_uuid']);
$zaak = $this->getZaak($configuration, $data['body']['case_uuid']);

if (isset($data['taakId']) === true) {
$this->updateTaak($zaak, $data['taakId']);
}
return $data;
}

Expand Down

0 comments on commit bcd9a5b

Please sign in to comment.