/** * @param PersonDto $person * @param string $dateOfBirth * @throws UpdateNodeException * @throws \Exception * * @return string */ public function updateAction(PersonDto $person, $dateOfBirth = '') { $profile = $this->profileService->getCurrentPartyProfile(); $referenceNode = $person->getReferenceNode(); if ($profile->getIdentifier() !== $referenceNode->getIdentifier()) { throw new UpdateNodeException('You can only update your own node', 125172979); } foreach ($person->getObjectVars() as $propertyName => $propertyValue) { if ($propertyName !== NULL && $propertyName !== 'referenceNode' && $propertyName !== 'image') { $properties[$propertyName] = $propertyValue; } } if ($dateOfBirth !== '') { $timestamp = strtotime($dateOfBirth); $dateOfBirth = new \DateTime(); $dateOfBirth->setTimestamp($timestamp); $properties['dateOfBirth'] = $dateOfBirth; } if (isset($properties)) { $this->nodeWriteRepository->updateNode($referenceNode, $properties); } $locale = new Locale('nl'); $this->response->setHeader('Notification', $this->translator->translateById('profile.update.success', [], NULL, $locale, 'Main', 'BuJitsuDo.Authentication')); return ''; }