WaiverFileService
in package
Waiver File Service
Handles file I/O operations for gathering waivers: single and multi-page image-to-PDF conversion, document storage, download, preview, and inline display.
Table of Contents
Properties
- $documentService : DocumentService
- $imageToPdfConversionService : ImageToPdfConversionService
- $retentionPolicyService : RetentionPolicyService
Methods
- __construct() : mixed
- Constructor
- deleteDocument() : void
- Delete a document by ID.
- documentPreviewExists() : bool
- Check if a document preview exists for a waiver.
- getDownloadResponse() : Response|null
- Get a document download response for a waiver.
- getInlinePdfResponse() : Response|null
- Get an inline PDF response for a waiver.
- getPreviewResponse() : Response|null
- Get a preview image response for a waiver.
- getRequiredWaiverTypes() : array<string|int, mixed>
- Get required waiver types for a gathering based on selected activities.
- getUploadLimits() : array<string|int, mixed>
- Get upload limits from PHP configuration.
- getWaiverStatusSummary() : array<string|int, mixed>
- Build a summary of existing waiver uploads and attestations for a gathering.
- isWaiverTypeAttested() : bool
- Check if a waiver type has been attested as not needed for a gathering.
- processMultipleWaiverImages() : ServiceResult
- Process multiple waiver images into a single multi-page PDF.
- processWaiverUpload() : ServiceResult
- Process a single waiver image upload into a PDF.
- formatBytes() : string
- Format bytes to human-readable size.
- parsePhpSize() : int
- Parse PHP size notation to bytes.
Properties
$documentService
private
DocumentService
$documentService
$imageToPdfConversionService
private
ImageToPdfConversionService
$imageToPdfConversionService
$retentionPolicyService
private
RetentionPolicyService
$retentionPolicyService
Methods
__construct()
Constructor
public
__construct() : mixed
deleteDocument()
Delete a document by ID.
public
deleteDocument(int $documentId) : void
Parameters
- $documentId : int
-
Document ID
documentPreviewExists()
Check if a document preview exists for a waiver.
public
documentPreviewExists(mixed $document) : bool
Parameters
- $document : mixed
-
Document entity
Return values
boolgetDownloadResponse()
Get a document download response for a waiver.
public
getDownloadResponse(int $waiverId) : Response|null
Parameters
- $waiverId : int
-
Waiver ID
Tags
Return values
Response|nullgetInlinePdfResponse()
Get an inline PDF response for a waiver.
public
getInlinePdfResponse(int $waiverId) : Response|null
Parameters
- $waiverId : int
-
Waiver ID
Return values
Response|nullgetPreviewResponse()
Get a preview image response for a waiver.
public
getPreviewResponse(int $waiverId) : Response|null
Parameters
- $waiverId : int
-
Waiver ID
Return values
Response|nullgetRequiredWaiverTypes()
Get required waiver types for a gathering based on selected activities.
public
getRequiredWaiverTypes(mixed $gathering) : array<string|int, mixed>
Parameters
- $gathering : mixed
-
Gathering entity with gathering_activities loaded
Return values
array<string|int, mixed> —Array of waiver type entities
getUploadLimits()
Get upload limits from PHP configuration.
public
getUploadLimits() : array<string|int, mixed>
Return values
array<string|int, mixed> —Upload limits with maxFileSize and formatted values
getWaiverStatusSummary()
Build a summary of existing waiver uploads and attestations for a gathering.
public
getWaiverStatusSummary(int $gatheringId, array<string|int, mixed> $requiredWaiverTypes) : array<string|int, mixed>
Parameters
- $gatheringId : int
-
Gathering ID
- $requiredWaiverTypes : array<string|int, mixed>
-
Required waiver types
Return values
array<string|int, mixed> —Summary of waiver status per type
isWaiverTypeAttested()
Check if a waiver type has been attested as not needed for a gathering.
public
isWaiverTypeAttested(int $gatheringId, int $waiverTypeId) : bool
Parameters
- $gatheringId : int
-
Gathering ID
- $waiverTypeId : int
-
Waiver type ID
Return values
boolprocessMultipleWaiverImages()
Process multiple waiver images into a single multi-page PDF.
public
processMultipleWaiverImages(array<string|int, mixed> $uploadedFiles, mixed $gathering, mixed $waiverType, string $notes, string|null $clientThumbnail, int $currentUserId) : ServiceResult
Parameters
- $uploadedFiles : array<string|int, mixed>
-
Array of UploadedFileInterface objects
- $gathering : mixed
-
Gathering entity
- $waiverType : mixed
-
WaiverType entity
- $notes : string
-
Notes for the waiver
- $clientThumbnail : string|null
-
Client-generated thumbnail data URL
- $currentUserId : int
-
Current user ID for uploaded_by
Return values
ServiceResultprocessWaiverUpload()
Process a single waiver image upload into a PDF.
public
processWaiverUpload(UploadedFileInterface $uploadedFile, mixed $gathering, mixed $waiverType, int|null $memberId, string $notes, int $currentUserId) : ServiceResult
Parameters
- $uploadedFile : UploadedFileInterface
-
Uploaded file
- $gathering : mixed
-
Gathering entity
- $waiverType : mixed
-
WaiverType entity
- $memberId : int|null
-
Optional member ID
- $notes : string
-
Optional notes
- $currentUserId : int
-
Current user ID for uploaded_by
Return values
ServiceResultformatBytes()
Format bytes to human-readable size.
private
formatBytes(int $bytes[, int $precision = 2 ]) : string
Parameters
- $bytes : int
-
Size in bytes
- $precision : int = 2
-
Decimal precision
Return values
string —Formatted size string
parsePhpSize()
Parse PHP size notation to bytes.
private
parsePhpSize(string $size) : int
Parameters
- $size : string
-
Size string from PHP ini setting
Return values
int —Size in bytes