MembersWorkflowActions
in package
uses
WorkflowContextAwareTrait, LocatorAwareTrait, QueuedMailerAwareTrait
Workflow action implementations for member lifecycle operations.
Delegates to MemberAuthenticationService and Member entity methods to avoid duplicating business logic.
Table of Contents
Properties
- $Members : MembersTable
- $mailer : Mailer
- $authService : MemberAuthenticationService
- $regService : MemberRegistrationService
Methods
- __construct() : mixed
- Initialize workflow member action collaborators.
- activate() : array<string|int, mixed>
- Activate a member account by setting status to active.
- ageUpMember() : array<string|int, mixed>
- Transition a single member from minor to adult status.
- assignStatusAndTokens() : array<string|int, mixed>
- Assign age-based status and generate auth tokens for an existing member.
- deactivate() : array<string|int, mixed>
- Deactivate a member account.
- prepareRegistrationEmailVars() : array<string|int, mixed>
- Prepare all registration email variables for use by Core.SendEmail workflow nodes.
- register() : array<string|int, mixed>
- Create and register a new member.
- sendPasswordReset() : array<string|int, mixed>
- Generate a password reset token and prepare email variables.
- sendRegistrationNotifications() : array<string|int, mixed>
- Queue the registration emails appropriate to the registration source and member age.
- syncWarrantableStatus() : array<string|int, mixed>
- Recalculate the warrantable flag for a member.
- updateMemberField() : array<string|int, mixed>
- Generic field update on a member entity.
- validatePasswordReset() : array<string|int, mixed>
- Validate a password reset token.
- verifyMembership() : array<string|int, mixed>
- Process membership verification for a member.
- queueMail() : Mailer
- Returns a mailer instance.
- queueMailJob() : void
- Queues a mail job to be processed later.
- resolveValue() : mixed
- Resolve a config value from context if it starts with '$.'.
- sendMailNow() : Mailer
- Returns a mailer instance.
- queueResetEmail() : void
- Queue the password reset email, logging on failure without breaking the action.
Properties
$Members
public
MembersTable
$Members
$mailer
protected
Mailer
$mailer
$authService
private
MemberAuthenticationService
$authService
$regService
private
MemberRegistrationService
$regService
Methods
__construct()
Initialize workflow member action collaborators.
public
__construct([MemberAuthenticationService|null $authService = null ][, MemberRegistrationService|null $regService = null ]) : mixed
Parameters
- $authService : MemberAuthenticationService|null = null
-
Optional auth service override
- $regService : MemberRegistrationService|null = null
-
Optional registration service override
activate()
Activate a member account by setting status to active.
public
activate(array<string|int, mixed> $context, array<string|int, mixed> $config) : array<string|int, mixed>
Parameters
- $context : array<string|int, mixed>
-
Current workflow context
- $config : array<string|int, mixed>
-
Config with memberId
Return values
array<string|int, mixed> —Output with activated boolean
ageUpMember()
Transition a single member from minor to adult status.
public
ageUpMember(array<string|int, mixed> $context, array<string|int, mixed> $config) : array<string|int, mixed>
Calls Member::ageUpReview() which handles status transitions and clears parent_id.
Parameters
- $context : array<string|int, mixed>
-
Current workflow context
- $config : array<string|int, mixed>
-
Config with memberId
Return values
array<string|int, mixed> —Output with transitioned boolean and new status
assignStatusAndTokens()
Assign age-based status and generate auth tokens for an existing member.
public
assignStatusAndTokens(array<string|int, mixed> $context, array<string|int, mixed> $config) : array<string|int, mixed>
Adults get STATUS_ACTIVE + password reset token; minors get STATUS_UNVERIFIED_MINOR.
Parameters
- $context : array<string|int, mixed>
-
Current workflow context
- $config : array<string|int, mixed>
-
Config with memberId
Return values
array<string|int, mixed> —Output with status
deactivate()
Deactivate a member account.
public
deactivate(array<string|int, mixed> $context, array<string|int, mixed> $config) : array<string|int, mixed>
Prepends "Deleted: " to email and sets status to deactivated, mirroring MembersController::delete() logic.
Parameters
- $context : array<string|int, mixed>
-
Current workflow context
- $config : array<string|int, mixed>
-
Config with memberId
Return values
array<string|int, mixed> —Output with deactivated boolean
prepareRegistrationEmailVars()
Prepare all registration email variables for use by Core.SendEmail workflow nodes.
public
prepareRegistrationEmailVars(array<string|int, mixed> $context, array<string|int, mixed> $config) : array<string|int, mixed>
Loads the member, builds registration vars, and resolves the secretary email addresses from app settings. Outputs all vars needed by the three registration email templates (member-registration-welcome, member-registration-secretary, member-registration-secretary-minor) into workflow context.
Parameters
- $context : array<string|int, mixed>
-
Current workflow context
- $config : array<string|int, mixed>
-
Config with memberId
Return values
array<string|int, mixed> —Output with registration email vars and secretary addresses
register()
Create and register a new member.
public
register(array<string|int, mixed> $context, array<string|int, mixed> $config) : array<string|int, mixed>
Parameters
- $context : array<string|int, mixed>
-
Current workflow context
- $config : array<string|int, mixed>
-
Config with registration data fields
Return values
array<string|int, mixed> —Output with memberId
sendPasswordReset()
Generate a password reset token and prepare email variables.
public
sendPasswordReset(array<string|int, mixed> $context, array<string|int, mixed> $config) : array<string|int, mixed>
Delegates to MemberAuthenticationService::generatePasswordResetToken() and queues the reset email.
Parameters
- $context : array<string|int, mixed>
-
Current workflow context
- $config : array<string|int, mixed>
-
Config with emailAddress
Return values
array<string|int, mixed> —Output with found, resetUrl
sendRegistrationNotifications()
Queue the registration emails appropriate to the registration source and member age.
public
sendRegistrationNotifications(array<string|int, mixed> $context, array<string|int, mixed> $config) : array<string|int, mixed>
Admin-created adult members do not receive registration workflow emails. Public self-registration queues the adult welcome email plus the adult secretary notice. Minor registrations queue the minor secretary notice for both sources.
Parameters
- $context : array<string|int, mixed>
-
Current workflow context
- $config : array<string|int, mixed>
-
Config with memberId and optional source
Return values
array<string|int, mixed> —Output with queued template slugs
syncWarrantableStatus()
Recalculate the warrantable flag for a member.
public
syncWarrantableStatus(array<string|int, mixed> $context, array<string|int, mixed> $config) : array<string|int, mixed>
Calls Member::warrantableReview() which checks age, status, membership expiration, legal name, address, and phone.
Parameters
- $context : array<string|int, mixed>
-
Current workflow context
- $config : array<string|int, mixed>
-
Config with memberId
Return values
array<string|int, mixed> —Output with warrantable boolean and reasons
updateMemberField()
Generic field update on a member entity.
public
updateMemberField(array<string|int, mixed> $context, array<string|int, mixed> $config) : array<string|int, mixed>
Parameters
- $context : array<string|int, mixed>
-
Current workflow context
- $config : array<string|int, mixed>
-
Config with memberId and fields (key-value pairs)
Return values
array<string|int, mixed> —Output with updated boolean
validatePasswordReset()
Validate a password reset token.
public
validatePasswordReset(array<string|int, mixed> $context, array<string|int, mixed> $config) : array<string|int, mixed>
Delegates to MemberAuthenticationService::validateResetToken().
Parameters
- $context : array<string|int, mixed>
-
Current workflow context
- $config : array<string|int, mixed>
-
Config with token
Return values
array<string|int, mixed> —Output with valid boolean, memberId
verifyMembership()
Process membership verification for a member.
public
verifyMembership(array<string|int, mixed> $context, array<string|int, mixed> $config) : array<string|int, mixed>
Handles status transitions based on age and verification type, mirroring MembersController::verifyMembership() logic.
Parameters
- $context : array<string|int, mixed>
-
Current workflow context
- $config : array<string|int, mixed>
-
Config with memberId, verifyMembership, verifyParent, membershipNumber, membershipExpiresOn, parentId
Return values
array<string|int, mixed> —Output with verified boolean and new status
queueMail()
Returns a mailer instance.
protected
queueMail(string $name, mixed $action, mixed $to, mixed $vars) : Mailer
Parameters
- $name : string
-
Mailer's name.
- $action : mixed
- $to : mixed
- $vars : mixed
Tags
Return values
MailerqueueMailJob()
Queues a mail job to be processed later.
protected
queueMailJob(array<string|int, mixed> $data) : void
Parameters
- $data : array<string|int, mixed>
-
Data to be passed to the mailer.
resolveValue()
Resolve a config value from context if it starts with '$.'.
protected
resolveValue(mixed $value, array<string|int, mixed> $context) : mixed
Parameters
- $value : mixed
-
Raw value or context path (e.g. '$.trigger.memberId')
- $context : array<string|int, mixed>
-
Current workflow context
Return values
mixed —Resolved value
sendMailNow()
Returns a mailer instance.
protected
sendMailNow(array<string|int, mixed> $data) : Mailer
Parameters
- $data : array<string|int, mixed>
Tags
Return values
MailerqueueResetEmail()
Queue the password reset email, logging on failure without breaking the action.
private
queueResetEmail(string $email, string $resetUrl) : void
Parameters
- $email : string
-
Recipient email
- $resetUrl : string
-
Password reset URL