From 4bfe413fafcd1cb7450191f9a7def8d5141ca59a Mon Sep 17 00:00:00 2001 From: Robert Zondervan Date: Mon, 17 Apr 2023 16:16:42 +0200 Subject: [PATCH 1/2] fix 502 --- src/Service/AssentService.php | 27 ++++++++++++++------------- 1 file changed, 14 insertions(+), 13 deletions(-) diff --git a/src/Service/AssentService.php b/src/Service/AssentService.php index 05120b6..f1f18a2 100644 --- a/src/Service/AssentService.php +++ b/src/Service/AssentService.php @@ -150,24 +150,25 @@ public function updateAssentHandler(array $data, array $config) throw new NotFoundHttpException("The assent with id {$data['path']['id']} was not found."); } - $assentData = $assent->toArray(); - // 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 + 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 - $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(); From 034bea9cf44fc4466fa76c0a5eda9b5675ba92cf Mon Sep 17 00:00:00 2001 From: GitHub Actions <> Date: Mon, 17 Apr 2023 14:17:05 +0000 Subject: [PATCH 2/2] Update src from PHP Codesniffer --- src/Service/AssentService.php | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/Service/AssentService.php b/src/Service/AssentService.php index f1f18a2..37ac75e 100644 --- a/src/Service/AssentService.php +++ b/src/Service/AssentService.php @@ -150,8 +150,7 @@ public function updateAssentHandler(array $data, array $config) throw new NotFoundHttpException("The assent with id {$data['path']['id']} was not found."); } - - if($assent->getValue('status') === 'granted') { + 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;