Skip to content

Commit

Permalink
Merge pull request #82 from CommonGateway/fix/assentPatch
Browse files Browse the repository at this point in the history
Fix 504's on partner updates
  • Loading branch information
rjzondervan authored Apr 18, 2023
2 parents 88054b9 + 034bea9 commit da44a0f
Showing 1 changed file with 14 additions and 14 deletions.
28 changes: 14 additions & 14 deletions src/Service/AssentService.php
Original file line number Diff line number Diff line change
Expand Up @@ -150,24 +150,24 @@ public function updateAssentHandler(array $data, array $config)
throw new NotFoundHttpException("The assent with id {$data['path']['id']} was not found.");
}

$assentData = $assent->toArray();
if ($assent->getValue('status') === 'granted') {
// get brp person from the logged in user
$brpPersons = $this->cacheService->searchObjects(null, ['burgerservicenummer' => $this->security->getUser()->getPerson()], [$brpSchema->getId()->toString()])['results'];
$brpPerson = null;
if (count($brpPersons) === 1) {
$brpPerson = $this->entityManager->find('App:ObjectEntity', $brpPersons[0]['_self']['id']);
}//end if

// get brp person from the logged in user
$brpPersons = $this->cacheService->searchObjects(null, ['burgerservicenummer' => $this->security->getUser()->getPerson()], [$brpSchema->getId()->toString()])['results'];
$brpPerson = null;
if (count($brpPersons) === 1) {
$brpPerson = $this->entityManager->find('App:ObjectEntity', $brpPersons[0]['_self']['id']);
}//end if
$person = $assent->getValue('contact');

$person = $assent->getValue('contact');
if ($person === false) {
$person = null;
}

if ($person === false) {
$person = null;
}
$person = $this->createPerson([], $brpPerson, $person);

$person = $this->createPerson([], $brpPerson, $person);

$assent->hydrate(['contact' => $person]);
$assent->hydrate(['contact' => $person]);
}

$this->entityManager->persist($assent);
$this->entityManager->flush();
Expand Down

0 comments on commit da44a0f

Please sign in to comment.