class DatabasePresenceVerifier implements DatabasePresenceVerifierInterface

Properties

protected string|null $connection

The database connection to use.

Methods

__construct(ConnectionResolverInterface $db)

Create a new database presence verifier.

int
getCount(string $collection, string $column, string $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.

addConditions(Builder $query, array $conditions)

Add the given conditions to the query.

void
addWhere(Builder $query, string $key, mixed $extraValue)

Add a "where" clause to the given query.

table(string $table)

Get a query builder for the given table.

void
setConnection(string|null $connection)

Set the connection to be used.

Details

at line 23
__construct(ConnectionResolverInterface $db)

Create a new database presence verifier.

Parameters

ConnectionResolverInterface $db

the database connection instance

at line 31
int getCount(string $collection, string $column, string $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
string $value
int|string|null $excludeId
string|null $idColumn
array $extra

Return Value

int

at line 45
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 55
protected Builder addConditions(Builder $query, array $conditions)

Add the given conditions to the query.

Parameters

Builder $query
array $conditions

Return Value

Builder

at line 73
protected void addWhere(Builder $query, string $key, mixed $extraValue)

Add a "where" clause to the given query.

Parameters

Builder $query
string $key
mixed $extraValue

Return Value

void

at line 91
protected Builder table(string $table)

Get a query builder for the given table.

Parameters

string $table

Return Value

Builder

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

Set the connection to be used.

Parameters

string|null $connection

Return Value

void