Constants

OP_ON_OR_BETWEEN

OP_ON_OR_BETWEEN

Operator constant for times in a range (inclusive).

OP_BETWEEN

OP_BETWEEN

Operator constant for times in a range (exclusive).

OP_ON_OR_BEFORE

OP_ON_OR_BEFORE

Operator constant for times before value (inclusive).

OP_BEFORE

OP_BEFORE

Operator constant for times before value (exclusive).

OP_ON_OR_AFTER

OP_ON_OR_AFTER

Operator constant for times after value (inclusive).

OP_AFTER

OP_AFTER

Operator constant for times after value (exclusive).

OP_IS

OP_IS

Operator constant for exact time match.

Properties

$tableName

$tableName : string

The name of the table in which the filtered column is present.

Type

string

$columnName

$columnName : string

The name of the DB column you need to filter.

Type

string

$inflector

$inflector : \Dewdrop\Inflector

Inflector object used when converting from operator to filter method name.

Type

\Dewdrop\Inflector

Methods

__construct()

__construct(string  $tableName, string  $columnName, \Dewdrop\Inflector  $inflector = null) 

Provide the table and column names that will be filtered by this object.

Parameters

string $tableName
string $columnName
\Dewdrop\Inflector $inflector

apply()

apply(\Dewdrop\Db\Select  $select, string  $conditionSetName, array  $queryVars) : \Dewdrop\Db\Select

Apply the filter to the supplied Select object.

Parameters

\Dewdrop\Db\Select $select
string $conditionSetName
array $queryVars

Throws

\Dewdrop\Db\Select\Filter\Exception\InvalidOperator
\Dewdrop\Db\Select\Filter\Exception\MissingQueryVar

Returns

\Dewdrop\Db\Select

filterOnOrBetween()

filterOnOrBetween(\Dewdrop\Db\Select  $select, string  $conditionSetName, string|null  $start, string|null  $end) : \Dewdrop\Db\Select

Filter the Select to find records on or between the start and end times.

Parameters

\Dewdrop\Db\Select $select
string $conditionSetName
string|null $start
string|null $end

Returns

\Dewdrop\Db\Select

filterBetween()

filterBetween(\Dewdrop\Db\Select  $select, string  $conditionSetName, string|null  $start, string|null  $end) : \Dewdrop\Db\Select

Filter the Select to find records between the start and end times.

Parameters

\Dewdrop\Db\Select $select
string $conditionSetName
string|null $start
string|null $end

Returns

\Dewdrop\Db\Select

filterBefore()

filterBefore(\Dewdrop\Db\Select  $select, string  $conditionSetName, string|null  $start, string|null  $end) : \Dewdrop\Db\Select

Parameters

\Dewdrop\Db\Select $select
string $conditionSetName
string|null $start
string|null $end

Returns

\Dewdrop\Db\Select

filterOnOrBefore()

filterOnOrBefore(\Dewdrop\Db\Select  $select, string  $conditionSetName, string|null  $start, string|null  $end) : \Dewdrop\Db\Select

Parameters

\Dewdrop\Db\Select $select
string $conditionSetName
string|null $start
string|null $end

Returns

\Dewdrop\Db\Select

filterAfter()

filterAfter(\Dewdrop\Db\Select  $select, string  $conditionSetName, string|null  $start, string|null  $end) : \Dewdrop\Db\Select

Parameters

\Dewdrop\Db\Select $select
string $conditionSetName
string|null $start
string|null $end

Returns

\Dewdrop\Db\Select

filterOnOrAfter()

filterOnOrAfter(\Dewdrop\Db\Select  $select, string  $conditionSetName, string|null  $start, string|null  $end) : \Dewdrop\Db\Select

Parameters

\Dewdrop\Db\Select $select
string $conditionSetName
string|null $start
string|null $end

Returns

\Dewdrop\Db\Select

filterIs()

filterIs(\Dewdrop\Db\Select  $select, string  $conditionSetName, string|null  $start, string|null  $end) : \Dewdrop\Db\Select

Parameters

\Dewdrop\Db\Select $select
string $conditionSetName
string|null $start
string|null $end

Returns

\Dewdrop\Db\Select

filterBetweenInternal()

filterBetweenInternal(boolean  $inclusive, \Dewdrop\Db\Select  $select, string  $conditionSetName, string|null  $start, string|null  $end) : \Dewdrop\Db\Select

This method does the heavy-lifting for the two "between" operators (both inclusive and exclusive). This method will attempt to handle situations where we don't actually have a start or end time by delegating to other methods.

Parameters

boolean $inclusive
\Dewdrop\Db\Select $select
string $conditionSetName
string|null $start
string|null $end

Returns

\Dewdrop\Db\Select

filterSingleInputInternal()

filterSingleInputInternal(boolean  $inclusive, \Dewdrop\Db\Select  $select, string  $conditionSetName, string  $type, string|null  $value) : \Dewdrop\Db\Select

This method does the heavy lifting for all the single-input operators this filter supports.

Parameters

boolean $inclusive
\Dewdrop\Db\Select $select
string $conditionSetName
string $type
string|null $value

Throws

\Exception

Returns

\Dewdrop\Db\Select

getAliasForComparison()

getAliasForComparison(\Dewdrop\Db\Select  $select) : string

Parameters

\Dewdrop\Db\Select $select

Returns

string

validate()

validate(array  $vars) 

Ensure the expected input vars were supplied before we attempt to apply a filter. We need the "comp" variable, which gives us the operator, along with start and end times.

Parameters

array $vars

Throws

\Dewdrop\Db\Select\Filter\Exception\InvalidOperator
\Dewdrop\Db\Select\Filter\Exception\MissingQueryVar

isValidOperator()

isValidOperator(string  $operator) : boolean

Check to see if the supplied operator is valid.

Parameters

string $operator

Returns

boolean