Skip to content

Commit

Permalink
Core update to searchobjects en countobjects, requires CoreBundle:1.4.13
Browse files Browse the repository at this point in the history
  • Loading branch information
WilcoLouwerse committed Jul 2, 2024
1 parent 30d2566 commit 97b651c
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
16 changes: 8 additions & 8 deletions Service/ZdsToZgwService(EXAMPLE).php
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ public function zaakIdentificatieActionHandler(array $data, array $config): arra
$mapping = $this->getMapping('https://zds.nl/mapping/zds.zdsZaakIdToZgwZaak.mapping.json');

$zaakArray = $this->mappingService->mapping($mapping, $data['body']);
$zaken = $this->cacheService->searchObjects(null, ['identificatie' => $zaakArray['identificatie']], [$zaakEntity->getId()->toString()])['results'];
$zaken = $this->cacheService->searchObjects(['identificatie' => $zaakArray['identificatie']], [$zaakEntity->getId()->toString()])['results'];
if ($zaken === []) {
$this->logger->debug('Creating new case with identifier'.$zaakArray['identificatie']);
$zaak = new ObjectEntity($zaakEntity);
Expand Down Expand Up @@ -188,7 +188,7 @@ public function documentIdentificatieActionHandler(array $data, array $config):
$mapping = $this->getMapping('https://zds.nl/mapping/zds.zdsDocumentIdToZgwDocument.mapping.json');

$documentArray = $this->mappingService->mapping($mapping, $data['body']);
$documents = $this->cacheService->searchObjects(null, ['identificatie' => $documentArray['identificatie']], [$documentEntity->getId()->toString()])['results'];
$documents = $this->cacheService->searchObjects(['identificatie' => $documentArray['identificatie']], [$documentEntity->getId()->toString()])['results'];
if ($documents === []) {
$this->logger->debug('Creating new document for identification'.$documentArray['identificatie']);
$document = new ObjectEntity($documentEntity);
Expand Down Expand Up @@ -223,7 +223,7 @@ public function connectEigenschappen(array $zaakArray, ObjectEntity $zaakType):
$eigenschapEntity = $this->getEntity('https://vng.opencatalogi.nl/schemas/ztc.eigenschap.schema.json');
$eigenschapObjects = $zaakType->getValue('eigenschappen');
foreach ($zaakArray['eigenschappen'] as $key => $eigenschap) {
$eigenschappen = $this->cacheService->searchObjects(null, ['naam' => $eigenschap['eigenschap']['naam'], 'zaaktype' => $zaakType->getSelf()], [$eigenschapEntity->getId()->toString()])['results'];
$eigenschappen = $this->cacheService->searchObjects(['naam' => $eigenschap['eigenschap']['naam'], 'zaaktype' => $zaakType->getSelf()], [$eigenschapEntity->getId()->toString()])['results'];
if ($eigenschappen !== []) {
$this->logger->debug('Property has been found, connecting to property');

Expand Down Expand Up @@ -266,7 +266,7 @@ public function connectRolTypes(array $zaakArray, ObjectEntity $zaakType): array
$rolTypeObjects = $zaakType->getValue('roltypen');

foreach ($zaakArray['rollen'] as $key => $role) {
$rollen = $this->cacheService->searchObjects(null, ['omschrijvingGeneriek' => $role['roltype']['omschrijvingGeneriek'], 'zaaktype' => $zaakType->getSelf()], [$rolTypeEntity->getId()->toString()])['results'];
$rollen = $this->cacheService->searchObjects(['omschrijvingGeneriek' => $role['roltype']['omschrijvingGeneriek'], 'zaaktype' => $zaakType->getSelf()], [$rolTypeEntity->getId()->toString()])['results'];
if ($rollen !== []) {
$this->logger->debug('Role type has been found, connecting to existing role type');
$zaakArray['rollen'][$key]['roltype'] = $rollen[0]['_self']['id'];
Expand Down Expand Up @@ -306,7 +306,7 @@ public function convertZaakType(array $zaakArray): array
$this->logger->debug('Trying to connect case to existing case type');

$zaakTypeEntity = $this->getEntity('https://vng.opencatalogi.nl/schemas/ztc.zaakType.schema.json');
$zaaktypes = $this->cacheService->searchObjects(null, ['identificatie' => $zaakArray['zaaktype']['identificatie']], [$zaakTypeEntity->getId()->toString()])['results'];
$zaaktypes = $this->cacheService->searchObjects(['identificatie' => $zaakArray['zaaktype']['identificatie']], [$zaakTypeEntity->getId()->toString()])['results'];
if (count($zaaktypes) > 0) {
$this->logger->debug('Case type found, connecting case to case type');

Expand Down Expand Up @@ -352,7 +352,7 @@ public function zaakActionHandler(array $data, array $config): array

$zaakArray = $this->convertZaakType($zaakArray);

$zaken = $this->cacheService->searchObjects(null, ['identificatie' => $zaakArray['identificatie']], [$zaakEntity->getId()->toString()])['results'];
$zaken = $this->cacheService->searchObjects(['identificatie' => $zaakArray['identificatie']], [$zaakEntity->getId()->toString()])['results'];
if (count($zaken) === 1) {
$this->logger->debug('Populating case with identification '.$zaakArray['identificatie']);

Expand Down Expand Up @@ -400,8 +400,8 @@ public function documentActionHandler(array $data, array $config): array

$zaakDocumentArray = $this->mappingService->mapping($mapping, $data['body']);

$documenten = $this->cacheService->searchObjects(null, ['identificatie' => $zaakDocumentArray['informatieobject']['identificatie']], [$documentEntity->getId()->toString()])['results'];
$zaken = $this->cacheService->searchObjects(null, ['identificatie' => $zaakDocumentArray['zaak']], [$zaakEntity->getId()->toString()])['results'];
$documenten = $this->cacheService->searchObjects(['identificatie' => $zaakDocumentArray['informatieobject']['identificatie']], [$documentEntity->getId()->toString()])['results'];
$zaken = $this->cacheService->searchObjects(['identificatie' => $zaakDocumentArray['zaak']], [$zaakEntity->getId()->toString()])['results'];
if (count($documenten) === 1 && count($zaken) === 1) {
$this->logger->debug('Populating document with identification'.$zaakDocumentArray['informatieobject']['identificatie']);

Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
"minimum-stability": "dev",
"require": {
"php": ">=7.4",
"commongateway/corebundle": "dev-master",
"commongateway/corebundle": "1.4.13 | <2.0",
"common-gateway/zgw-bundle": "^0.1"
},
"require-dev": {
Expand Down

0 comments on commit 97b651c

Please sign in to comment.