final class PrecomputedPresenceVerifier implements DatabasePresenceVerifierInterface

Return database-proven presence facts from batched queries.

Lookups and fallback memoization are scoped to one validation execution and keyed by the complete database query shape. Unknown probes delegate to the original verifier, preserving ordinary validation semantics.

Methods

static string|null
lookupKey(string|null $connection, string $collection, string $column, int|string|null $excludeId = null, string|null $idColumn = null, array $extra = [])

Build a key for the complete database query shape.

void
addLookup(string $lookupKey, array $exactHits, array $knownPresent, array $provenAbsent, bool $stageOneSingleChunk)

Register database-proven facts for one query shape.

int
getCount(string $collection, string $column, mixed $value, int|string|null $excludeId = null, string|null $idColumn = null, array $extra = [])

Count the number of objects in a collection having the given value.

int
getMultiCount(string $collection, string $column, array $values, array $extra = [])

Count the number of objects in a collection with the given values.

void
setConnection(string|null $connection)

Set the connection to be used.

bool
hasLookups()

Determine if any lookups have been registered.

static string|null
bindingKey(mixed $value)

Build a key for the PDO binding identity of a supported presence value.

static string|null
normalizeValue(mixed $value)

Normalize a supported presence value for lookup comparisons.

Details

at line 33
__construct(DatabasePresenceVerifierInterface $fallback)

No description

Parameters

DatabasePresenceVerifierInterface $fallback

at line 41
static string|null lookupKey(string|null $connection, string $collection, string $column, int|string|null $excludeId = null, string|null $idColumn = null, array $extra = [])

Build a key for the complete database query shape.

Parameters

string|null $connection
string $collection
string $column
int|string|null $excludeId
string|null $idColumn
array $extra

Return Value

string|null

at line 82
void addLookup(string $lookupKey, array $exactHits, array $knownPresent, array $provenAbsent, bool $stageOneSingleChunk)

Register database-proven facts for one query shape.

Parameters

string $lookupKey
array $exactHits
array $knownPresent
array $provenAbsent
bool $stageOneSingleChunk

Return Value

void

at line 102
int getCount(string $collection, string $column, mixed $value, int|string|null $excludeId = null, string|null $idColumn = null, array $extra = [])

Count the number of objects in a collection having the given value.

Parameters

string $collection
string $column
mixed $value
int|string|null $excludeId
string|null $idColumn
array $extra

Return Value

int

at line 143
int getMultiCount(string $collection, string $column, array $values, array $extra = [])

Count the number of objects in a collection with the given values.

Parameters

string $collection
string $column
array $values
array $extra

Return Value

int

at line 197
void setConnection(string|null $connection)

Set the connection to be used.

Parameters

string|null $connection

Return Value

void

at line 206
bool hasLookups()

Determine if any lookups have been registered.

Return Value

bool

at line 217
static string|null bindingKey(mixed $value)

Build a key for the PDO binding identity of a supported presence value.

The one-character prefix preserves integer/string PDO binding identity and prevents PHP from coercing numeric-string array keys to integers.

Parameters

mixed $value

Return Value

string|null

at line 229
static string|null normalizeValue(mixed $value)

Normalize a supported presence value for lookup comparisons.

Parameters

mixed $value

Return Value

string|null