Skip to content

Commit

Permalink
w.i.p. send documents (ZaakinformatieObjecten) to VrijBRP Dossier API
Browse files Browse the repository at this point in the history
  • Loading branch information
WilcoLouwerse committed Sep 9, 2024
1 parent df434aa commit 7cbe714
Showing 1 changed file with 21 additions and 2 deletions.
23 changes: 21 additions & 2 deletions src/Service/ZgwToVrijbrpService.php
Original file line number Diff line number Diff line change
Expand Up @@ -95,16 +95,35 @@ public function checkCasesToVrijBRPHandler(array $data, array $configuration): a

// Loop through results and start throwing events that will send api requests to VrijBRP.
foreach ($result['results'] as $zaak) {
$this->style->writeln('Handling case with id: '.$zaak['_id'].' & case type: '.$zaak['embedded']['zaaktype']['identificatie']);
if (isset($this->style) === true) {
$this->style->writeln('Handling case with id: '.$zaak['_id'].' & case type: '.$zaak['embedded']['zaaktype']['identificatie']);

Check warning on line 99 in src/Service/ZgwToVrijbrpService.php

View workflow job for this annotation

GitHub Actions / build

Line exceeds 125 characters; contains 142 characters
}

// Let's make sure we send the data of this object with the thrown event in the exact same way we did before
// without embedded for example (in other Bundles like ZdsToZGWBundle)
$object = $this->entityManager->getRepository('App:ObjectEntity')->find($zaak['_id']);
$data['object'] = $object->toArray();

// Throw (async) event for mapping and sending information to VrijBRP.
// Throw (async) event for mapping and sending information to VrijBRP soap API.
$event = new ActionEvent('commongateway.action.event', $data, 'vrijbrp.zaak.created');
$this->eventDispatcher->dispatch($event, 'commongateway.action.event');

if (empty($zaak['embedded']['zaakinformatieobjecten']) === false) {
foreach ($zaak['embedded']['zaakinformatieobjecten'] as $zaakInformatieObject) {
if (isset($this->style) === true) {
$this->style->writeln('Handling document '.$zaakInformatieObject['titel'].' for case with id: '.$zaak['_id'].' & case type: '.$zaak['embedded']['zaaktype']['identificatie']);
}

// Let's make sure we send the data of this object with the thrown event in the exact same way we did before

Check warning on line 117 in src/Service/ZgwToVrijbrpService.php

View workflow job for this annotation

GitHub Actions / build

Line exceeds 125 characters; contains 128 characters
// without embedded for example (in other Bundles like ZdsToZGWBundle)
$object = $this->entityManager->getRepository('App:ObjectEntity')->find($zaakInformatieObject['_id']);

Check warning on line 119 in src/Service/ZgwToVrijbrpService.php

View workflow job for this annotation

GitHub Actions / build

Line exceeds 125 characters; contains 135 characters
$data['documents'][] = $object->toArray();
}

// Throw (async) event for mapping and sending information to VrijBRP Dossier API.
$event = new ActionEvent('commongateway.action.event', $data, 'vrijbrp.document.created');
$this->eventDispatcher->dispatch($event, 'commongateway.action.event');
}
}

return $data;
Expand Down

0 comments on commit 7cbe714

Please sign in to comment.