Class AfBaseFilter
All filter classes should extend AfBaseFilter. It contains abstract functions that must be implemented by child classes, as well as some helper functions for common filter operations.
- CComponent
- AfBaseFilter
Direct known subclasses
AfDefaultFilter
,
AfExactFilter
,
AfRangeFilter
,
AfRegexFilter
,
AfSubstringFilter
Package: advancedfilters\filters
Author: Keith Burton kburton@kappasoft.net
Located at filters/AfBaseFilter.php
Methods summary
public
|
#
__construct( string $columnExpression, string $filterExpression, boolean $invertLogic, CDbConnection $dbConnection,
Constructor. Subclasses of AfBaseFilter should not be instantiated directly, but by using methods of the application component. |
protected
string
|
#
getColumnExpression( )
Gets the column expression, with the result coalesced to an empty string if $this->treatNullAsEmptyString is true. |
protected
string
|
|
protected
boolean
|
#
getInvertLogic( )
Specifies whether the filter logic should be inverted in the resulting database criteria. |
protected
|
#
getDbHelper( )
Gets a database helper class to provide database specific syntax for filter criteria. |
protected
CDbConnection
|
#
getDbConnection( )
Gets a connection to the relevant database so that filters can perform queries directly, in order to validate syntax. |
public static
|
#
createFilter( string $columnExpression, string $filterExpression, boolean $invertLogic, CDbConnection $dbConnection,
Instantiate and return the first filter that can process the provided filter expression. |
protected static
boolean|string
|
#
stripPrefixSuffixString( string $string, string $prefix, string $suffix )
A generic helper function to strip a specified prefix and suffix from a string if both are found. The prefix and/or suffix can be an empty string, to allow matching at only one side of the string. Comparison of the prefix and suffix is case insensitive. |
abstract public
boolean
|
#
acceptsFilterExpression( )
The implementation of this method should analyse the filter expression to determine whether this filter accepts the expression. |
abstract public
CDbCriteria
|
#
getCriteria( )
Gets a CDbCriteria object with the filter conditions applied. The criteria can be merged with an existing criteria object. |
Magic methods summary
Properties summary
public
boolean
|
$active
whether this filter should be included when processing filter expressions. |
#
true
|
public
integer
|
$priority
the priority with which this should be processed. Smaller numbers are processed first. |
#
0
|
public
boolean
|
$treatNullAsEmptyString
whether null results from column expressions should be coalesced to empty strings. This allows the columns to be included in filter results. |
#
true
|