CoolCMS API

DateEqualFilter extends DateFilter
in package

Table of Contents

Properties

$applyToCollections  : bool
$fields  : array<string|int, string>
$format  : string
$fromTableAlias  : string|null
$operator  : string
$phaseOneOnly  : bool
$textTableAlias  : string|null
$value  : mixed

Methods

__construct()  : mixed
appliesToCollections()  : bool
Tells whether the filter also applies to ToMany branch queries (phase 2 of hydration).
apply()  : void
Applies the filter to the Doctrine QueryBuilder.
applyWithCondition()  : string|null
Default implementation for simple operators (`=`, `!=`, `<`, `<=`, `>`, `>=`, `LIKE`, `NOT LIKE`).
getBindings()  : ArrayCollection<int, Parameter>
Returns the filter's parameter bindings.
getFields()  : array<string|int, string>
Returns the field or fields the filter applies to.
getOperator()  : string
getType()  : string
Returns the filter type/operator (e.g. '=', 'LIKE', 'IN').
getValue()  : mixed
Returns the filter value.
isPhaseOneOnly()  : bool
When true, the filter applies only to phase 1 (root ID selection) and does not leak into the ToMany branch queries of the second hydration phase.
setApplyToCollections()  : static
setFields()  : static
Sets the field or fields the filter applies to.
setFromTableAlias()  : static
Sets the alias of the main table for join operations.
setPhaseOneOnly()  : static
setTextTableAlias()  : static
Sets the alias of the text (translations) table for join operations.
toSql()  : string
Builds the SQL condition for the filter.

Properties

$applyToCollections

protected bool $applyToCollections = false

$fields

protected array<string|int, string> $fields

field names; always an array, even when a single name was passed (the constructor and setFields() normalize it)

$format read-only

protected string $format = 'Y-m-d'

$fromTableAlias

protected string|null $fromTableAlias = null

$phaseOneOnly

protected bool $phaseOneOnly = false

$textTableAlias

protected string|null $textTableAlias = null

Methods

__construct()

public __construct(array<string|int, string>|string $fields, mixed $value[, string $format = 'Y-m-d' ]) : mixed
Parameters
$fields : array<string|int, string>|string
$value : mixed
$format : string = 'Y-m-d'

appliesToCollections()

Tells whether the filter also applies to ToMany branch queries (phase 2 of hydration).

public appliesToCollections() : bool

The filter decides which parents are returned (phase 1); includes decide what is loaded for them, and always in full. A dotted filter is therefore not propagated to the branch query (OrmRepository::filtersForBranch()): otherwise the collection would be silently trimmed to the matching subset and an object-graph save would INSERT the unmatched children again (UNIQUE violation, the save works only the first time).

setApplyToCollections(true) is an explicit opt-in for the rare caller that really wants the trimmed collection (e.g. orders loaded only with items X); such a caller must not save anything through it afterwards.

Return values
bool

apply()

Applies the filter to the Doctrine QueryBuilder.

public apply(QueryBuilder $qb, int|string $index) : void
Parameters
$qb : QueryBuilder
$index : int|string

applyWithCondition()

Default implementation for simple operators (`=`, `!=`, `<`, `<=`, `>`, `>=`, `LIKE`, `NOT LIKE`).

public applyWithCondition(QueryBuilder $qb, string $joinAlias, string $column, int &$paramIndex) : string|null

Special filters (IS NULL, IN, BETWEEN, RANGE) override this method.

Parameters
$qb : QueryBuilder
$joinAlias : string
$column : string
$paramIndex : int

parameter counter passed by reference (incremented inside)

Return values
string|null

getBindings()

Returns the filter's parameter bindings.

public getBindings([string|int|null $index = null ]) : ArrayCollection<int, Parameter>
Parameters
$index : string|int|null = null
Return values
ArrayCollection<int, Parameter>

getFields()

Returns the field or fields the filter applies to.

public getFields() : array<string|int, string>
Return values
array<string|int, string>

getOperator()

public getOperator() : string
Return values
string

getType()

Returns the filter type/operator (e.g. '=', 'LIKE', 'IN').

public getType() : string
Return values
string

getValue()

Returns the filter value.

public getValue() : mixed

isPhaseOneOnly()

When true, the filter applies only to phase 1 (root ID selection) and does not leak into the ToMany branch queries of the second hydration phase.

public isPhaseOneOnly() : bool

Use case: searching adverts by a single parameter — find adverts that have that parameter, but in the detail load all of their parameters, not just the filtered one.

Return values
bool

setApplyToCollections()

public setApplyToCollections([bool $applyToCollections = true ]) : static
Parameters
$applyToCollections : bool = true
Return values
static

setFields()

Sets the field or fields the filter applies to.

public setFields(array<string|int, string>|string $fields) : static
Parameters
$fields : array<string|int, string>|string
Return values
static

setFromTableAlias()

Sets the alias of the main table for join operations.

public final setFromTableAlias(string|null $alias) : static
Parameters
$alias : string|null
Return values
static

setPhaseOneOnly()

public setPhaseOneOnly([bool $phaseOneOnly = true ]) : static
Parameters
$phaseOneOnly : bool = true
Return values
static

setTextTableAlias()

Sets the alias of the text (translations) table for join operations.

public final setTextTableAlias(string|null $alias) : static
Parameters
$alias : string|null
Return values
static

toSql()

Builds the SQL condition for the filter.

public toSql(QueryBuilder $qb[, int|null $index = null ]) : string
Parameters
$qb : QueryBuilder
$index : int|null = null
Return values
string
On this page

Search results