Yii Advanced Filters Extension
  • Package
  • Class

Packages

  • advancedfilters
    • components
    • dbhelpers
    • filters

Classes

  • AfDbCriteria
  • AfException
  • AfParser

Class AfParser

This class is responsible for parsing the entered expression into segments split by the "and" and "or" delimiters, and determining whether logic should be inverted.

The resulting segments are passed to AfBaseFilter to construct an appropriate filter object.

CComponent
Extended by AfParser
Package: advancedfilters\components
Author: Keith Burton kburton@kappasoft.net
Located at components/AfParser.php

Methods summary

public
# __construct( string $columnExpression, string $filterExpression, array $config )

Parses the provided filter expression into segments and creates an array of filters to process the full expression.

Parses the provided filter expression into segments and creates an array of filters to process the full expression.

This class should not be instantiated directly, but by using methods of the AdvancedFilters application component.

Parameters

$columnExpression

the disambiguated column name (or a valid SQL expression).

$filterExpression
the entered filter expression.
$config
the configuration array.
public CDbCriteria
# getCriteria( )

Returns a CDbCriteria object created by merging the criteria returned from all filters.

Returns a CDbCriteria object created by merging the criteria returned from all filters.

Returns

CDbCriteria
the criteria object.

Magic methods summary

Properties summary

public string $orDelimiter

the string used to 'or' filter expressions together. Set this to an empty string to remove this functionality.

the string used to 'or' filter expressions together. Set this to an empty string to remove this functionality.

# '|'
public string $andDelimiter

the string used to 'and' filter expressions together. Set this to an empty string to remove this functionality.

the string used to 'and' filter expressions together. Set this to an empty string to remove this functionality.

# '&'
public string $escapeSequence

the string which can be prepended to a delimiter string to allow its use within a filter expression. Set this to an empty string to disallow escaping.

the string which can be prepended to a delimiter string to allow its use within a filter expression. Set this to an empty string to disallow escaping.

# '\\'
public string $invertLogicPrefix

the string which can be prepended to a filter expression in order to invert its logic and return the opposite results. You can specify values for both $invertLogicPrefix and $invertLogicSuffix to require that the expression be enclosed between two specific strings in order to invert the logic. Set both to an empty string to prevent logic inversion.

the string which can be prepended to a filter expression in order to invert its logic and return the opposite results. You can specify values for both $invertLogicPrefix and $invertLogicSuffix to require that the expression be enclosed between two specific strings in order to invert the logic. Set both to an empty string to prevent logic inversion.

# '!'
public string $invertLogicSuffix

the string which can be appended to a filter expression in order to invert its logic and return the opposite results. You can specify values for both $invertLogicPrefix and $invertLogicSuffix to require that the expression be enclosed between two specific strings in order to invert the logic. Set both to an empty string to prevent logic inversion.

the string which can be appended to a filter expression in order to invert its logic and return the opposite results. You can specify values for both $invertLogicPrefix and $invertLogicSuffix to require that the expression be enclosed between two specific strings in order to invert the logic. Set both to an empty string to prevent logic inversion.

# ''
public CDbConnection|string $dbConnection

either a CDbConnection object or the string name of an application component representing a CDbConnection. Defaults to 'db'.

either a CDbConnection object or the string name of an application component representing a CDbConnection. Defaults to 'db'.

# 'db'
public array $driverMap

mapping between PDO driver and database helper class path. Each database helper must extend AfBaseDbHelper. If the $dbConnection has a driver name that is not specified in this array, or it maps to null, an AfException will be thrown.

mapping between PDO driver and database helper class path. Each database helper must extend AfBaseDbHelper. If the $dbConnection has a driver name that is not specified in this array, or it maps to null, an AfException will be thrown.

# array( 'pgsql'=>null, // PostgreSQL 'mysqli'=>'AfMysqlDbHelper', // MySQL 'mysql'=>'AfMysqlDbHelper', // MySQL 'sqlite'=>null, // sqlite 3 'sqlite2'=>null, // sqlite 2 'mssql'=>'AfMssqlDbHelper', // Mssql driver on windows 'dblib'=>'AfMssqlDbHelper', // dblib drivers on linux 'sqlsrv'=>'AfMssqlDbHelper', // Mssql 'oci'=>null, // Oracle driver )
public array $filterConfig

the default filters to load, and the priorities of each. Lower priority values mean that the pattern will be tested against the filter earlier, so more specific filters should be given a lower number than more general filters. Override the 'active' property to specify whether each filter should be used when processing filter expressions. The default filter cannot be deactivated. Any additional configuration will be applied to the specific filter class when it is instantiated.

the default filters to load, and the priorities of each. Lower priority values mean that the pattern will be tested against the filter earlier, so more specific filters should be given a lower number than more general filters. Override the 'active' property to specify whether each filter should be used when processing filter expressions. The default filter cannot be deactivated. Any additional configuration will be applied to the specific filter class when it is instantiated.

# array( 'range'=>array( 'class'=>'AfRangeFilter', 'priority'=>10, ), 'exact'=>array( 'class'=>'AfExactFilter', 'priority'=>20, ), 'substring'=>array( 'class'=>'AfSubstringFilter', 'priority'=>30, ), 'regex'=>array( 'class'=>'AfRegexFilter', 'priority'=>40, ), 'default'=>array( 'class'=>'AfDefaultFilter', 'priority'=>50, ), )
Yii Advanced Filters Extension API documentation generated by ApiGen