From 995a237f535955b96c0e962ca6a2d1138d80f50c Mon Sep 17 00:00:00 2001 From: Florian Eisenmenger Date: Wed, 12 Jun 2024 16:33:49 +0200 Subject: [PATCH] bugfix --- src/Mapper/TaskNoteEntityToApiMapper.php | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/src/Mapper/TaskNoteEntityToApiMapper.php b/src/Mapper/TaskNoteEntityToApiMapper.php index 2de069c..046e2b0 100644 --- a/src/Mapper/TaskNoteEntityToApiMapper.php +++ b/src/Mapper/TaskNoteEntityToApiMapper.php @@ -47,13 +47,15 @@ class TaskNoteEntityToApiMapper implements MapperInterface MicroMapperInterface::MAX_DEPTH => 1, ]); - $dto->contact = $this->microMapper->map($entity->getContact(), ContactApi::class, [ - MicroMapperInterface::MAX_DEPTH => 1, - ]); + if ($entity->getContact() !== null) { + $dto->contact = $this->microMapper->map($entity->getContact(), ContactApi::class, [ + MicroMapperInterface::MAX_DEPTH => 1, + ]); - $dto->contactIri = $this->microMapper->map($entity->getContact(), ContactApi::class, [ - MicroMapperInterface::MAX_DEPTH => 1, - ]); + $dto->contactIri = $this->microMapper->map($entity->getContact(), ContactApi::class, [ + MicroMapperInterface::MAX_DEPTH => 1, + ]); + } $dto->contactType = $entity->getType();