FilterCollection
in package
Collection class for all the query filters.
Table of Contents
- FILTERS_STATE_CLEAN = 1
- A filter object is in CLEAN state when it has no changed parameters.
- FILTERS_STATE_DIRTY = 2
- A filter object is in DIRTY state when it has changed parameters.
- $config : Configuration
- The used Configuration.
- $em : EntityManager
- The EntityManager that "owns" this FilterCollection instance.
- $enabledFilters : array<string|int, SQLFilter>
- Instances of enabled filters.
- $filterHash : string
- $filtersState : int
- __construct() : mixed
- disable() : SQLFilter
- Disables a filter.
- enable() : SQLFilter
- Enables a filter from the collection.
- getEnabledFilters() : array<string|int, SQLFilter>
- Gets all the enabled filters.
- getFilter() : SQLFilter
- Gets an enabled filter from the collection.
- getHash() : string
- Generates a string of currently enabled filters to use for the cache id.
- has() : bool
- Checks whether filter with given name is defined.
- isClean() : bool
- isEnabled() : bool
- Checks if a filter is enabled.
- setFiltersStateDirty() : void
- Sets the filter state to dirty.
Constants
FILTERS_STATE_CLEAN
A filter object is in CLEAN state when it has no changed parameters.
public
mixed
FILTERS_STATE_CLEAN
= 1
FILTERS_STATE_DIRTY
A filter object is in DIRTY state when it has changed parameters.
public
mixed
FILTERS_STATE_DIRTY
= 2
Properties
$config
The used Configuration.
private
Configuration
$config
$em
The EntityManager that "owns" this FilterCollection instance.
private
EntityManager
$em
$enabledFilters
Instances of enabled filters.
private
array<string|int, SQLFilter>
$enabledFilters
= []
$filterHash
private
string
$filterHash
The filter hash from the last time the query was parsed.
$filtersState
private
int
$filtersState
= self::FILTERS_STATE_CLEAN
The current state of this filter.
Methods
__construct()
public
__construct(EntityManagerInterface $em) : mixed
Parameters
- $em : EntityManagerInterface
Return values
mixed —disable()
Disables a filter.
public
disable(string $name) : SQLFilter
Parameters
- $name : string
-
Name of the filter.
Tags
Return values
SQLFilter —The disabled filter.
enable()
Enables a filter from the collection.
public
enable(string $name) : SQLFilter
Parameters
- $name : string
-
Name of the filter.
Tags
Return values
SQLFilter —The enabled filter.
getEnabledFilters()
Gets all the enabled filters.
public
getEnabledFilters() : array<string|int, SQLFilter>
Return values
array<string|int, SQLFilter> —The enabled filters.
getFilter()
Gets an enabled filter from the collection.
public
getFilter(string $name) : SQLFilter
Parameters
- $name : string
-
Name of the filter.
Tags
Return values
SQLFilter —The filter.
getHash()
Generates a string of currently enabled filters to use for the cache id.
public
getHash() : string
Return values
string —has()
Checks whether filter with given name is defined.
public
has(string $name) : bool
Parameters
- $name : string
-
Name of the filter.
Return values
bool —true if the filter exists, false if not.
isClean()
public
isClean() : bool
Return values
bool —True, if the filter collection is clean.
isEnabled()
Checks if a filter is enabled.
public
isEnabled(string $name) : bool
Parameters
- $name : string
-
Name of the filter.
Return values
bool —True if the filter is enabled, false otherwise.
setFiltersStateDirty()
Sets the filter state to dirty.
public
setFiltersStateDirty() : void