PHP Class Prado\Data\DataGateway\TSqlCriteria

Criteria object for data gateway finder methods. Usage: $criteria = new TSqlCriteria(); $criteria->Parameters[':name'] = 'admin'; $criteria->Parameters[':pass'] = 'prado'; $criteria->OrdersBy['level'] = 'desc'; $criteria->OrdersBy['name'] = 'asc'; $criteria->Limit = 10; $criteria->Offset = 20;
Since: 3.1
Inheritance: extends Prado\TComponent
Show file Open project: pradosoft/prado Class Usage Examples

Public Methods

Method Description
__construct ( $condition = null, $parameters = [] ) Creates a new criteria with given condition;
__toString ( ) : string
getCondition ( ) : string
getIsNamedParameters ( ) : boolean
getLimit ( ) : integer
getOffset ( ) : integer
getOrdersBy ( ) : TAttributeCollection
getParameters ( ) : TAttributeCollection
getSelect ( ) : mixed Gets the field list to be placed after the SELECT in the SQL. Default to '*'
setCondition ( $value ) Sets the search conditions to be placed after the WHERE clause in the SQL.
setLimit ( $value )
setOffset ( $value )
setOrdersBy ( $value )
setParameters ( $value )
setSelect ( $value ) Sets the field list to be placed after the SELECT in the SQL.

Method Details

__construct() public method

Creates a new criteria with given condition;
public __construct ( $condition = null, $parameters = [] )

__toString() public method

public __toString ( ) : string
return string string representation of the parameters. Useful for debugging.

getCondition() public method

public getCondition ( ) : string
return string search conditions.

getIsNamedParameters() public method

public getIsNamedParameters ( ) : boolean
return boolean true if the parameter index are string base, false otherwise.

getLimit() public method

public getLimit ( ) : integer
return integer maximum number of records to return.

getOffset() public method

public getOffset ( ) : integer
return integer record offset.

getOrdersBy() public method

public getOrdersBy ( ) : TAttributeCollection
return Prado\Collections\TAttributeCollection ordering clause.

getParameters() public method

public getParameters ( ) : TAttributeCollection
return Prado\Collections\TAttributeCollection list of named parameters and values.

getSelect() public method

Gets the field list to be placed after the SELECT in the SQL. Default to '*'
Since: 3.1.7
public getSelect ( ) : mixed
return mixed

setCondition() public method

Sets the search conditions to be placed after the WHERE clause in the SQL.
public setCondition ( $value )

setLimit() public method

public setLimit ( $value )

setOffset() public method

public setOffset ( $value )

setOrdersBy() public method

public setOrdersBy ( $value )

setParameters() public method

public setParameters ( $value )

setSelect() public method

Different behavior depends on type of assigned value string usage without modification null will be expanded to full list of quoted table column names (quoting depends on database) array - Column names will be quoted if used as key or value of array array('col1', 'col2', 'col2') SELECT col1, col2, col3 FROM... - Column aliasing array('mycol1' => 'col1', 'mycol2' => 'COUNT(*)') SELECT col1 AS mycol1, COUNT(*) AS mycol2 FROM... - NULL and scalar values (strings will be quoted depending on database) array('col1' => 'my custom string', 'col2' => 1.0, 'col3' => 'NULL') SELECT "my custom string" AS col1, 1.0 AS col2, NULL AS col3 FROM... - If the *-wildcard char is used as key or value, add the full list of quoted table column names array('col1' => 'NULL', '*') SELECT col1, col2, col3, NULL AS col1 FROM...
See also: TDbCommandBuilder::getSelectFieldList()
Since: 3.1.7
public setSelect ( $value )