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();