phpPeanuts  2.2.0
phpPeanuts framework
 All Data Structures Namespaces Files Functions Variables
Public Member Functions | Static Public Member Functions | Data Fields
PntSqlFilter Class Reference

Inherits PntSqlSpec.

Inherited by PntSqlCombiFilter, and PntSqlJoinFilter.

Public Member Functions

 initPropertyDescriptors ()
 
 getId ()
 
 getPath ()
 
 getItemType ()
 
 getPropLabel ()
 
 appliesTo ($type, $persistent=false)
 
 getTableAlias ()
 
 getItemTableName ()
 
 getValueProp ()
 
 getValueType ()
 
 setComparatorId ($value)
 
 setValue1 ($value)
 
 setValue2 ($value)
 
 by ($comparatorId, $value1=null, $value2=null)
 
 andWhere ($path, $comparatorId=null, $value1=null, $value2=null)
 
 orWhere ($path, $comparatorId=null, $value1=null, $value2=null)
 
 sortBy ($path, $direction='ASC')
 
 getFieldMapPrefixed ()
 
 getSqlTemplate ()
 
 addParamsTo ($qh)
 
 getColumnName ()
 
 generateSql (&$aliasCount, &$paramCount, $backTrack=array())
 
 getSql ()
 
 getSqlForGroupBy ()
 
 getGroupBySql ()
 
 getGroupByField ()
 
 getSql_WhereToLimit ($groupBy=true)
 
 getExtraSelectExpressions ()
 
 getDescription ($conv)
 
 initConverter ($conv)
 
 getPersistArray ()
 
 initFromPersistArray ($array)
 
 getNavigation ()
 
 getLast ()
 
 canBeSortSpec ()
 
 ignoreGlobalFilter ($wheater)
 
 evaluate ($item)
 
 evaluateValue ($value)
 
 assocSelectFrom (&$array)
 
 selectFrom (&$array)
 
 compare ($a, $b)
 
 __clone ()
 
- Public Member Functions inherited from PntSqlSpec
 __construct ($id=null)
 
 getId ()
 
 getLabel ()
 
 getQueryHandler ()
 
 getDescription ($conv)
 
 setDescription ($value)
 
 getSqlForJoin ()
 
 generateSqlForJoins (&$aliasCount, &$paramCount, $backTrack=array())
 
 isJoinFilter ()
 
 where ($path, $comparatorId=null, $value1=null, $value2=null)
 
 sortBy ($path, $direction='ASC')
 
 retrieve ()
 
 retrieveFirst ()
 
 retrieveOne ()
 
- Public Member Functions inherited from PntObject
 __construct ()
 
 copy ()
 
 getClass ()
 
 getClassDescriptor ()
 
 initPropertyDescriptors ()
 
 getOid ()
 
 addFieldProp ($name, $type, $readOnly=false, $minValue=null, $maxValue=null, $minLength=0, $maxLength=null, $classDir=null, $persistent=true)
 
 addDerivedProp ($name, $type, $readOnly=true, $minValue=null, $maxValue=null, $minLength=0, $maxLength=null, $classDir=null)
 
 addMultiValueProp ($name, $type, $readOnly=true, $minValue=null, $maxValue=null, $minLength=0, $maxLength=null, $classDir=null)
 
 getPropertyDescriptor ($propertyName)
 
 get ($propertyName, $filter=true)
 
 set ($propertyName, $value)
 
 getOptions ($name, $filter=true)
 
 getValueValidator ($prop)
 
 validateGetErrorString ($prop, $value, $validateReadOnly=true)
 
 basicGetLabel ()
 
 getLabel ()
 
 __toString ()
 
 release ()
 
 getEditInfo ()
 
 toString ()
 
 _getValueValidator ($prop)
 

Static Public Member Functions

static getInstance ($itemType, $path, $comparatorId=null, $value1=null, $value2=null)
 
static getInstanceForNav ($nav)
 
static instanceFromPersistArray ($array)
 
- Static Public Member Functions inherited from PntSqlSpec
 initPropertyDescriptors ()
 
- Static Public Member Functions inherited from PntObject
static isPersistent ()
 
static getClassDescriptorClass ()
 
static getClassDir ()
 
static getClassLabel ()
 
static getUiColumnPaths ()
 
static getReportColumnPaths ()
 
static getUiFieldPaths ($clsDes)
 
static newNavigation ($key, $itemType)
 

Data Fields

 $comparatorId = 0
 
 $valueType
 
 $tableAlias
 
 $itemTableName
 
 $key
 
 $value1
 
 $value2
 
 $columnName
 
 $sqlTemplate
 
 $navigation
 
 $visible = true
 
- Data Fields inherited from PntSqlSpec
 $label
 
 $propLabel
 
 $itemType
 

Member Function Documentation

__clone ( )
addParamsTo (   $qh)

Add the parameter values from this to $qh

Parameters
PntDao$qh
andWhere (   $path,
  $comparatorId = null,
  $value1 = null,
  $value2 = null 
)

(Navigational query DSL)

Returns
PntSqlCombiFilter for AND this with the specified
Parameters
string$paththe path to AND filter by, or PntSqlFilter to AND filter by
string$comparatorIdone id from PntComparator::getInstances
mixed$value1dynamically typed by >>valueType
mixed$value2dynamically typed by >>valueType
Exceptions
PntReflectionError
appliesTo (   $type,
  $persistent = false 
)
Returns
boolean wheather the filter applies to the itemType
Parameters
string$typetype name
booleanwheather using ::getSql
assocSelectFrom ( $array)

Select objects from $array that match $this, leaving keys intact

by (   $comparatorId,
  $value1 = null,
  $value2 = null 
)

(Navigational query DSL) Sets comparator and values to filter by

Parameters
string$comparatorIdone id from PntComparator::getInstances
mixed$value1dynamically typed by >>valueType
mixed$value2dynamically typed by >>valueType
Returns
PntSqlFilter $this
Exceptions
PntReflectionError
canBeSortSpec ( )
compare (   $a,
  $b 
)
evaluate (   $item)
evaluateValue (   $value)

Return the result of comparing the supplied value to the vaules of this, using the comparator

generateSql ( $aliasCount,
$paramCount,
  $backTrack = array() 
)
getColumnName ( )
getDescription (   $conv)
getExtraSelectExpressions ( )
getFieldMapPrefixed ( )
getGroupByField ( )

Returns the name of the field to use for GROUP BY,

See Also
getSqlForGroupBy
getGroupBySql ( )
getId ( )
static getInstance (   $itemType,
  $path,
  $comparatorId = null,
  $value1 = null,
  $value2 = null 
)
static
Parameters
string$itemTypetype of items to filter from/retrieve
string$paththe path to filter by
string$comparatorIdone id from PntComparator::getInstances
mixed$value1dynamically typed by >>valueType
mixed$value2dynamically typed by >>valueType
Returns
PntSqlFilter as specified
Exceptions
PntReflectionError
static getInstanceForNav (   $nav)
static
Parameters
PntObjectNavigation$nav
Returns
PntSqlFilter as specified
Exceptions
PntReflectionError
getItemTableName ( )

The name of the table the column is stored in. Used for creating join condition. if the key and itemtype do not identify a persistent fieldProperty, this must be set explicitly

getItemType ( )
getLast ( )
getNavigation ( )
Exceptions
PntError
getPath ( )
getPersistArray ( )
getPropLabel ( )
getSql ( )
getSql_WhereToLimit (   $groupBy = true)

Returns what comes after the WHERE clause up to but not including the LIMIT clause. This includes eventual ORDER BY, GROUP BY and HAVING clauses

getSqlForGroupBy ( )

When querying for peanuts, JOINS may be made to search by colums related by a 1 to m relationship. Without GROUP BY this will lead to a row for each value found in each related column. In practice one wants each peanut only once. By grouping by id only one row is returned for each column.

Returns
String complete GROUP BY clause PRECONDITION: all columns in the FROM clause must contain the same value for each row this condition will be met when only single value column path are used, which is the case with the WHERE clause of PntDbClassDescriptor::getSelectQueryHandler
getSqlTemplate ( )
getTableAlias ( )

the alias or tablename to be used as prefix with the columnName. Set by previous JoinFilter

getValueProp ( )
getValueType ( )
ignoreGlobalFilter (   $wheater)

Normal filters do not apply global filters, but ValidVersionFilters do, unless this method is called with true as the argument

initConverter (   $conv)

Initialize the converter

Parameters
$convPntStringConverter
initFromPersistArray (   $array)
initPropertyDescriptors ( )
static instanceFromPersistArray (   $array)
static

Create a new instance according to the supplied array

PRECONDITION: the class of the filter has to be included

Parameters
array$arraycreated by ::getPersistArray
Returns
PntSqlFilter
Exceptions
PntReflectionError
orWhere (   $path,
  $comparatorId = null,
  $value1 = null,
  $value2 = null 
)

(Navigational query DSL)

Returns
PntSqlCombiFilter for OR this with the specified
Parameters
string$paththe path to OR filter by, or PntSqlFilter to OR filter by
string$comparatorIdone id from PntComparator::getInstances
mixed$value1dynamically typed by >>valueType
mixed$value2dynamically typed by >>valueType
Exceptions
PntReflectionError
selectFrom ( $array)

Select objects from $array that match $this, renumbering the keys

setComparatorId (   $value)
setValue1 (   $value)
setValue2 (   $value)
sortBy (   $path,
  $direction = 'ASC' 
)

(Navigational query DSL)

Parameters
string$paththe path to sort by
string$direction'ASC' or 'DESC'
Returns
PntSqlSort for sorting the results of this
Exceptions
PntReflectionErrorif the path does not exist from >>itemType

Field Documentation

$columnName
$comparatorId = 0
$itemTableName
$key
$navigation
$sqlTemplate
$tableAlias
$value1
$value2
$valueType
$visible = true

The documentation for this class was generated from the following file: