CRUDUI PHP API

ReferenceRule
in package
implements RuleInterface

AbstractYes

A rule that compares a value with the value of another field: a missing or empty parameter switches it off, the parameter names the other field, and the rule itself compares the two.

Table of Contents

Interfaces

RuleInterface
Interface for validation rules.

Methods

validate()  : bool
Validate that a value agrees with the value of the field that the parameter names.
agrees()  : bool
Whether the value agrees with the value of the other field.

Methods

validate()

Validate that a value agrees with the value of the field that the parameter names.

public validate(mixed $value, mixed $param, array<string|int, mixed> $allData, FieldPath $path) : bool
Parameters
$value : mixed

The value to validate

$param : mixed

The rule parameter (e.g., min length, pattern, etc.)

$allData : array<string|int, mixed>

All form data (for cross-field validation)

$path : FieldPath

The data path of the value with the positions of its row keys

Return values
bool —

True if valid, false otherwise

agrees()

Whether the value agrees with the value of the other field.

protected abstract agrees(mixed $value, mixed $reference) : bool
Parameters
$value : mixed
$reference : mixed
Return values
bool
On this page

Search results