final class RecordWriteResult (View source)

Outcome of a record write. Replaces the bool return plus MessageService side channel: callers read the reason, the HTTP status and the offending form field from here instead of the session.

Constants

FIELD_NAME

FIELD_CONTENT

FIELD_TTL

FIELD_PRIO

FIELD_DUPLICATE

Methods

ok(int|string|null $recordId = null)

No description

failure(string $message, int $status = 400, string|null $field = null)

No description

forbidden(string $message)

No description

notFound(string $message)

No description

backendFailure(string $message)

No description

static string
fieldForMessage(string $message)

Validators report a message, not a field; this keeps the one heuristic the forms used to carry each, until ValidationResult names the field itself.

Details

static RecordWriteResult ok(int|string|null $recordId = null)

No description

Parameters

int|string|null $recordId

The new id on create; edits and deletes carry none

Return Value

RecordWriteResult

static RecordWriteResult failure(string $message, int $status = 400, string|null $field = null)

No description

Parameters

string $message
int $status
string|null $field

The form field the message is about; guessed from the message when omitted

Return Value

RecordWriteResult

static RecordWriteResult forbidden(string $message)

No description

Parameters

string $message

Return Value

RecordWriteResult

static RecordWriteResult notFound(string $message)

No description

Parameters

string $message

Return Value

RecordWriteResult

static RecordWriteResult backendFailure(string $message)

No description

Parameters

string $message

Return Value

RecordWriteResult

static string fieldForMessage(string $message)

Validators report a message, not a field; this keeps the one heuristic the forms used to carry each, until ValidationResult names the field itself.

Parameters

string $message

Return Value

string