Skip to content

Commit

Permalink
Merge pull request #71 from CommonGateway/fix/expands
Browse files Browse the repository at this point in the history
Fixes from ZGW tests Roxit: expanded objects and a case identifier default
  • Loading branch information
rjzondervan authored Jul 18, 2023
2 parents 7f83e59 + 9d27824 commit 865bf55
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 8 deletions.
5 changes: 3 additions & 2 deletions Installation/Schema/zrc/zrc.zaak.schema.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"$id": "https://vng.opencatalogi.nl/schemas/zrc.zaak.schema.json",
"$schema": "https://docs.commongateway.nl/schemas/Entity.schema.json",
"version": "0.2.7",
"version": "0.2.8",
"title": "Zaak",
"description": "Indien geen identificatie gegeven is, dan wordt deze automatisch gegenereerd. De identificatie moet uniek zijn binnen de bronorganisatie.\n\nEr wordt gevalideerd op:\n\ngeldigheid zaaktype URL - de resource moet opgevraagd kunnen worden uit de Catalogi API en de vorm van een ZAAKTYPE hebben.\nzaaktype is geen concept (zaaktype.concept = False)\nlaatsteBetaaldatum mag niet in de toekomst liggen.\nlaatsteBetaaldatum mag niet gezet worden als de betalingsindicatie \"nvt\" is.\nbarchiefnominatie moet een waarde hebben indien archiefstatus niet de waarde \"nog_te_archiveren\" heeft.\narchiefactiedatum moet een waarde hebben indien archiefstatus niet de waarde \"nog_te_archiveren\" heeft.\narchiefstatus kan alleen een waarde anders dan \"nog_te_archiveren\" hebben indien van alle gerelateeerde INFORMATIEOBJECTen het attribuut status de waarde \"gearchiveerd\" heeft.",
"type": "object",
Expand Down Expand Up @@ -34,7 +34,8 @@
"title": "Identificatie",
"description": "De unieke identificatie van de ZAAK binnen de organisatie die verantwoordelijk is voor de behandeling van de ZAAK.",
"type": "string",
"maxLength": 40
"maxLength": 40,
"default": "{{ object.id }}{# TODO: This must be done in a way that the id is human readable #}"
},
"bronorganisatie": {
"type": "string",
Expand Down
6 changes: 3 additions & 3 deletions Service/DRCService.php
Original file line number Diff line number Diff line change
Expand Up @@ -267,7 +267,7 @@ public function drcReleaseHandler(array $data, array $configuration): array
$this->entityManager->flush();

$this->data['response'] = new Response(
\Safe\json_encode($objectEntity->toArray()),
\Safe\json_encode($objectEntity->toArray(['embedded' => true])),
$this->data['method'] === 'POST' ? 201 : 200,
['content-type' => 'application/json']
);
Expand Down Expand Up @@ -353,7 +353,7 @@ public function inhoudHandler(array $data, array $configuration): array
$this->entityManager->flush();

$this->data['response'] = new Response(
\Safe\json_encode($objectEntity->toArray()),
\Safe\json_encode($objectEntity->toArray(['embedded' => true])),
$this->data['method'] === 'POST' ? 201 : 200,
['content-type' => 'application/json']
);
Expand Down Expand Up @@ -408,7 +408,7 @@ public function uploadFilePartHandler(array $data, array $configuration): array
$this->entityManager->persist($file);
$this->entityManager->flush();

$this->data['response'] = new Response(\Safe\json_encode($responseObject->toArray()), 200, ['content-type' => 'application/json']);
$this->data['response'] = new Response(\Safe\json_encode($responseObject->toArray(['embedded' => true])), 200, ['content-type' => 'application/json']);

return $this->data;

Expand Down
6 changes: 3 additions & 3 deletions Service/ZGWService.php
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ public function postZaakBesluitHandler(array $data, array $configuration): array
$this->entityManager->persist($zaakBesluit);
$this->entityManager->flush();

$this->data['response'] = new Response(json_encode($zaakBesluit->toArray()), 200);
$this->data['response'] = new Response(json_encode($zaakBesluit->toArray(['embedded' => true])), 200);
break;

case 'GET':
Expand All @@ -90,7 +90,7 @@ public function postZaakBesluitHandler(array $data, array $configuration): array
$zaakBesluit = $this->entityManager->getRepository('App:ObjectEntity')->find($besluitId);
if ($zaakBesluit instanceof ObjectEntity === true) {

$this->data['response'] = new Response(json_encode($zaakBesluit->toArray()), 200);
$this->data['response'] = new Response(json_encode($zaakBesluit->toArray(['embedded' => true])), 200);
}
} else { // else get all besluiten from this zaak.
$zaakBesluitEntity = $this->entityManager->getRepository('App:Entity')->findOneBy(['reference' => 'https://vng.opencatalogi.nl/schemas/zrc.zaakBesluit.schema.json']);
Expand Down Expand Up @@ -191,7 +191,7 @@ public function ztcPublishHandler(array $data, array $configuration): array
$this->entityManager->persist($object);
$this->entityManager->flush();

$data['response'] = new Response(\Safe\json_encode($object->toArray()), 201, ['Content-Type' => 'application/json']);
$data['response'] = new Response(\Safe\json_encode($object->toArray(['embedded' => true])), 201, ['Content-Type' => 'application/json']);

return $data;

Expand Down

0 comments on commit 865bf55

Please sign in to comment.