MemberProfileService
in package
uses
LocatorAwareTrait
Handles profile photo management for members.
Covers photo validation, upload via DocumentService, old photo cleanup, atomic removal, inline streaming, and mobile card email URL building. Controller-layer concerns (request parsing, flash, authorization) remain in MembersController.
Table of Contents
Properties
Methods
- __construct() : mixed
- Initialize the profile service.
- buildMobileCardUrl() : string
- Build the mobile card URL for emailing to a member.
- getProfilePhotoEtag() : string
- Return the cache validator for the current profile-photo thumbnail.
- getProfilePhotoResponse() : Response|null
- Stream a profile photo document as an inline response.
- processProfilePhotoUpload() : array{success: bool, message: string, warning?: bool}
- Validate, upload, and assign a profile photo to a member.
- removeProfilePhoto() : array{success: bool, message: string}
- Remove a member's profile photo and underlying document atomically.
- getDocumentService() : DocumentService
- Reuse document storage initialization throughout the request.
Properties
$documentService
private
DocumentService|null
$documentService
= null
$Members
private
MembersTable
$Members
Methods
__construct()
Initialize the profile service.
public
__construct() : mixed
buildMobileCardUrl()
Build the mobile card URL for emailing to a member.
public
buildMobileCardUrl() : string
Return values
string —Absolute URL to the ViewMobileCard action.
getProfilePhotoEtag()
Return the cache validator for the current profile-photo thumbnail.
public
getProfilePhotoEtag(Member $member) : string
Parameters
- $member : Member
Return values
stringgetProfilePhotoResponse()
Stream a profile photo document as an inline response.
public
getProfilePhotoResponse(Member $member, string $filenamePrefix) : Response|null
Parameters
- $member : Member
-
Member with ProfilePhoto loaded.
- $filenamePrefix : string
-
Prefix for the download filename (e.g. 'member_profile_photo_').
Return values
Response|null —Response with streamed content, or null if unavailable.
processProfilePhotoUpload()
Validate, upload, and assign a profile photo to a member.
public
processProfilePhotoUpload(Member $member, UploadedFileInterface $file, int $uploaderId) : array{success: bool, message: string, warning?: bool}
Parameters
- $member : Member
-
Target member entity with ProfilePhoto relation loaded.
- $file : UploadedFileInterface
-
Uploaded image file.
- $uploaderId : int
-
ID of the member performing the upload.
Return values
array{success: bool, message: string, warning?: bool}removeProfilePhoto()
Remove a member's profile photo and underlying document atomically.
public
removeProfilePhoto(Member $member, int $oldDocumentId) : array{success: bool, message: string}
Parameters
- $member : Member
-
Member with ProfilePhoto loaded.
- $oldDocumentId : int
-
Document ID to delete.
Return values
array{success: bool, message: string}getDocumentService()
Reuse document storage initialization throughout the request.
private
getDocumentService() : DocumentService