handle case when user is null in comment embeddable

This commit is contained in:
Julien Fastré 2022-03-22 23:36:02 +01:00
parent c5ffca22ff
commit 99dc9dd4a8

View File

@ -52,7 +52,11 @@ class CommentEmbeddableDocGenNormalizer implements ContextAwareNormalizerInterfa
];
}
$user = $this->userRepository->find($object->getUserId());
if (null === $object->getUserId()) {
$user = null;
} else {
$user = $this->userRepository->find($object->getUserId());
}
return [
'comment' => $object->getComment(),