id === null) { throw new BadRequestException('id is required'); } $element = $this->elementRepository->find($request->id); if ($element === null) { throw new NotFoundException('Element not found'); } return $element; } }