SearchFilter
class SearchFilter
Base class for filtering implementations, which work together with {@link SearchContext} to create or amend a query for {@link DataObject} instances.
See {@link SearchContext} for more information.
Each search filter must be registered in config as an "Injector" service with the "DataListFilter." prefix. E.g.
Injector:
DataListFilter.EndsWith:
class: EndsWithFilter
Traits
Methods
An implementation of the factory method, allows you to create an instance of a class
Creates a class instance by the "singleton" design pattern.
No description
Set the root model class to be selected by this search query.
Set the current value(s) to be filtered on.
Accessor for the current value to be filtered on.
Set the current modifiers to apply to the filter
Gets supported modifiers for this filter
Accessor for the current modifiers to apply to the filter.
The original name of the field.
No description
The full name passed to the constructor, including any (optional) relations in dot notation.
No description
Normalizes the field name to table mapping.
Return the value of the field as processed by the DBField class
Given an escaped HAVING clause, add it along with the appropriate GROUP BY clause
Determines if a field has a value, and that the filter should be applied.
Details
in Injectable at line 26
static Injectable
create(array $args)
An implementation of the factory method, allows you to create an instance of a class
This method will defer class substitution to the Injector API, which can be customised via the Config API to declare substitution classes.
This can be called in one of two ways - either calling via the class directly, or calling on Object and passing the class name as the first parameter. The following are equivalent: $list = DataList::create('SiteTree'); $list = SiteTree::get();
in Injectable at line 43
static Injectable
singleton(string $class = null)
Creates a class instance by the "singleton" design pattern.
It will always return the same instance for this class, which can be used for performance reasons and as a simple way to access instance methods which don't rely on instance data (e.g. the custom SilverStripe static handling).
at line 88
__construct(string $fullName = null, mixed $value = false, array $modifiers = array())
at line 149
setModel(string|DataObject $className)
Set the root model class to be selected by this search query.
at line 159
setValue(string|array $value)
Set the current value(s) to be filtered on.
at line 169
string|array
getValue()
Accessor for the current value to be filtered on.
at line 179
setModifiers(array $modifiers)
Set the current modifiers to apply to the filter
at line 200
array
getSupportedModifiers()
Gets supported modifiers for this filter
at line 211
array
getModifiers()
Accessor for the current modifiers to apply to the filter.
at line 221
string
getName()
The original name of the field.
at line 229
setName(String $name)
at line 240
string
getFullName()
The full name passed to the constructor, including any (optional) relations in dot notation.
at line 248
setFullName(String $name)
at line 258
string
getDbName()
Normalizes the field name to table mapping.
at line 317
string
getDbFormattedValue()
Return the value of the field as processed by the DBField class
at line 338
DataQuery
applyAggregate(DataQuery $query, string $having)
Given an escaped HAVING clause, add it along with the appropriate GROUP BY clause
at line 432
boolean
isEmpty()
Determines if a field has a value, and that the filter should be applied.
Relies on the field being populated with {@link setValue()}