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.
- 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.
Properties
$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.
getProfilePhotoResponse()
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.