linkRepository->find($uriVariables['id'] ?? 0); if (null === $link) { throw new NotFoundHttpException('Link not found.'); } $dto = new BookStackLink(); $dto->id = $link->getId(); return $dto; } $taskId = $uriVariables['taskId'] ?? 0; $links = $this->linkRepository->findByTaskId($taskId); return array_map(static function (TaskBookStackLink $link): BookStackLink { $dto = new BookStackLink(); $dto->id = $link->getId(); $dto->bookstackId = $link->getBookstackId(); $dto->bookstackType = $link->getBookstackType(); $dto->title = $link->getTitle(); $dto->url = $link->getUrl(); $dto->createdAt = $link->getCreatedAt()->format('c'); return $dto; }, $links); } }