Oihana PHP Arango

InvitationsModelTrait

Standalone trait for the `invitations` Documents model dependency.

Used by middlewares / controllers / commands that need to read or update invitation records (user invite flow, password-set acceptance, email-change confirmation, post-callback finalization, etc.).

Tags
author

Marc Alcaraz

Table of Contents

Constants

INVITATIONS_MODEL  : string = 'invitationsModel'
Initialization key for the invitations Documents model.

Properties

$invitationsModel  : Documents|null
The invitations Documents model.

Methods

cancelPendingInvitations()  : int
Soft-cancels every pending invitation targeting the given user.
initializeInvitationsModel()  : static
Initializes the invitations model dependency from the $init array.

Constants

INVITATIONS_MODEL

Initialization key for the invitations Documents model.

public string INVITATIONS_MODEL = 'invitationsModel'

Properties

Methods

cancelPendingInvitations()

Soft-cancels every pending invitation targeting the given user.

protected cancelPendingInvitations(string $userKey[, bool $loggable = true ]) : int

Runs as part of the user deletion cascade: the invitation document is kept for audit with actionStatus = cancelled and a fresh modified timestamp.

Failures are logged but swallowed — a broken invitation update must never prevent the core user deletion from proceeding.

The count it returns lets a caller act on the outcome — for instance, mark the user's own invitation status only when an invitation was actually cancelled. A failure halfway through returns the invitations cancelled before it.

Parameters
$userKey : string
$loggable : bool = true
Tags
throws
ContainerExceptionInterface
NotFoundExceptionInterface
Throwable
Return values
int —

The number of invitations flipped to cancelled — 0 without a model, with nothing pending, or when the first write fails.

initializeInvitationsModel()

Initializes the invitations model dependency from the $init array.

protected initializeInvitationsModel(array<string|int, mixed> $init, Container|null $container) : static
Parameters
$init : array<string|int, mixed>

The initialization array.

$container : Container|null

The DI container.

Tags
throws
ContainerExceptionInterface
NotFoundExceptionInterface
Return values
static
On this page

Search results