Propel 2 API
Class

Propel\Runtime\ActiveQuery\Criteria

class Criteria

This is a utility class for holding criteria information for a query.

Constants

EQUAL

Comparison type.

NOT_EQUAL

Comparison type.

ALT_NOT_EQUAL

Comparison type.

GREATER_THAN

Comparison type.

LESS_THAN

Comparison type.

GREATER_EQUAL

Comparison type.

LESS_EQUAL

Comparison type.

LIKE

Comparison type.

NOT_LIKE

Comparison type.

CONTAINS_ALL

Comparison for array column types

CONTAINS_SOME

Comparison for array column types

CONTAINS_NONE

Comparison for array column types

ILIKE

PostgreSQL comparison type

NOT_ILIKE

PostgreSQL comparison type

CUSTOM

Comparison type.

RAW

Comparison type

CUSTOM_EQUAL

Comparison type for update

DISTINCT

Comparison type.

IN

Comparison type.

NOT_IN

Comparison type.

ALL

Comparison type.

JOIN

Comparison type.

BINARY_AND

Binary math operator: AND

BINARY_OR

Binary math operator: OR

ASC

'Order by' qualifier - ascending

DESC

'Order by' qualifier - descending

ISNULL

'IS NULL' null comparison

ISNOTNULL

'IS NOT NULL' null comparison

CURRENT_DATE

'CURRENT_DATE' ANSI SQL function

CURRENT_TIME

'CURRENT_TIME' ANSI SQL function

CURRENT_TIMESTAMP

'CURRENT_TIMESTAMP' ANSI SQL function

LEFT_JOIN

'LEFT JOIN' SQL statement

RIGHT_JOIN

'RIGHT JOIN' SQL statement

INNER_JOIN

'INNER JOIN' SQL statement

LOGICAL_OR

logical OR operator

LOGICAL_AND

logical AND operator

Methods

__construct(String $dbName = null)

Creates a new instance with the default capacity which corresponds to the specified database.

array getMap()

Get the criteria map, i.e.

void clear()

Brings this criteria back to its initial state, so that it can be reused as if it was new.

Criteria addAsColumn(string $name, string $clause)

Add an AS clause to the select columns.

array getAsColumns()

Get the column aliases.

string getColumnForAs($as)

Returns the column name associated with an alias (AS-column).

Criteria addAlias(string $alias, string $table)

Allows one to specify an alias for a table that can be used in various parts of the SQL.

Criteria removeAlias(string $alias)

Remove an alias for a table (useful when merging Criterias).

array getAliases()

Returns the aliases for this Criteria

string getTableForAlias(string $alias)

Returns the table name associated with an alias.

array($tableName, getTableNameAndAlias(string $tableAliasOrName)

Returns the table name and alias based on a table alias or name.

array keys()

Get the keys of the criteria map, i.e.

boolean containsKey(string $column)

Does this Criteria object contain the specified key?

boolean keyContainsValue(string $column)

Does this Criteria object contain the specified key and does it have a value set for the key

boolean hasWhereClause()

Whether this Criteria has any where columns.

void setUseTransaction($v)

Will force the sql represented by this criteria to be executed within a transaction.

boolean isUseTransaction()

Whether the sql command specified by this criteria must be wrapped in a transaction.

AbstractCriterion getCriterion(string $column)

Method to return criteria related to columns in a table.

AbstractCriterion getLastCriterion()

Method to return the latest Criterion in a table.

AbstractCriterion getNewCriterion(string $column, mixed $value = null, string $comparison = self::EQUAL)

Method to return a Criterion that is not added automatically to this Criteria.

string getColumnName(string $name)

Method to return a String table name.

array getTablesColumns()

Shortcut method to get an array of columns indexed by table.

string getComparison(string $key)

Method to return a comparison String.

string getDbName()

Get the Database(Map) name.

void setDbName(string $dbName = null)

Set the DatabaseMap name.

string getPrimaryTableName()

Get the primary table for this Criteria.

setPrimaryTableName($tableName)

Sets the primary table for this Criteria.

string getTableName(string $name)

Method to return a String table name.

mixed getValue(string $name)

Method to return the value that was added to Criteria.

mixed get(string $key)

An alias to getValue() -- exposing a Hashtable-like interface.

Instance put(string $key, mixed $value)

Overrides Hashtable put, so that this object is returned instead of the value previously in the Criteria object.

putAll(mixed $t)

Copies all of the mappings from the specified Map to this Criteria These mappings will replace any mappings that this Criteria had for any of the keys currently in the specified Map.

A add($p1, $value = null, $comparison = null)

This method adds a new criterion to the list of criterias.

string __toString()

A addCond(string $name, string $p1, mixed $value = null, string $comparison = null)

This method creates a new criterion but keeps it for later use with combine() Until combine() is called, the condition is not added to the query

combine(array $criterions = array(), string $operator = self::LOGICAL_AND, string $name = null)

Combine several named criterions with a logical operator

Criteria addJoin(mixed $left, mixed $right, mixed $joinType = null)

This is the way that you should add a join of two tables.

Criteria addMultipleJoin(array $conditions, string $joinType = null)

Add a join with multiple conditions

Criteria addJoinObject(Join $join)

Add a join object to the Criteria

array getJoins()

Get the array of Joins.

Criteria addSelectQuery(Criteria $subQueryCriteria, string $alias = null)

Adds a Criteria as subQuery in the From Clause.

boolean hasSelectQueries()

Checks whether this Criteria has a subquery.

array getSelectQueries()

Get the associative array of Criteria for the subQueries per alias.

Criteria getSelectQuery(string $alias)

Get the Criteria for a specific subQuery.

boolean hasSelectQuery(string $alias)

checks if the Criteria for a specific subQuery is set.

forgeSelectQueryAlias()

Criteria setAll()

Adds 'ALL' modifier to the SQL statement.

Criteria setDistinct()

Adds 'DISTINCT' modifier to the SQL statement.

Criteria addSelectModifier(string $modifier)

Adds a modifier to the SQL statement.

Criteria removeSelectModifier(string $modifier)

Removes a modifier to the SQL statement.

boolean hasSelectModifier(string $modifier)

Checks the existence of a SQL select modifier

Criteria setIgnoreCase(boolean $b)

Sets ignore case.

boolean isIgnoreCase()

Is ignore case on or off?

Criteria setSingleRecord(boolean $b)

Set single record? Set this to <code>true</code> if you expect the query to result in only a single result record (the default behaviour is to throw a PropelException if multiple records are returned when the query is executed).

boolean isSingleRecord()

Is single record?

Criteria setLimit(int $limit)

Set limit.

int getLimit()

Get limit.

Criteria setOffset(int $offset)

Set offset.

int getOffset()

Get offset.

Criteria addSelectColumn(string $name)

Add select column.

Criteria setComment(string $comment = null)

Set the query comment, that appears after the first verb in the SQL query

string getComment()

Get the query comment, that appears after the first verb in the SQL query

boolean hasSelectClause()

Whether this Criteria has any select columns.

array getSelectColumns()

Get select columns.

Criteria clearSelectColumns()

Clears current select columns.

An getSelectModifiers()

Get select modifiers.

A addGroupByColumn(string $groupBy)

Add group by column name.

A addAscendingOrderByColumn(string $name)

Add order by column name, explicitly specifying ascending.

Criteria addDescendingOrderByColumn(string $name)

Add order by column name, explicitly specifying descending.

array getOrderByColumns()

Get order by columns.

Criteria clearOrderByColumns()

Clear the order-by columns.

Criteria clearGroupByColumns()

Clear the group-by columns.

array getGroupByColumns()

Get group by columns.

AbstractCriterion getHaving()

Get Having Criterion.

mixed remove(string $key)

Remove an object from the criteria.

string toString()

Build a string representation of the Criteria.

int size()

Returns the size (count) of this criteria.

boolean equals($crit)

This method checks another Criteria to see if they contain the same attributes and hashtable entries.

Criteria mergeWith(Criteria $criteria, string $operator = null)

Add the content of a Criteria to the current Criteria In case of conflict, the current Criteria keeps its properties

A addHaving(mixed $p1, mixed $value = null, mixed $comparison = null)

This method adds a prepared Criterion object to the Criteria as a having clause.

Criteria addAnd($p1, $p2 = null, $p3 = null, $preferColumnCondition = true)

If a criterion for the requested column already exists, the condition is "AND"ed to the existing criterion (necessary for Propel 1.4 compatibility).

Criteria addOr($p1, $p2 = null, $p3 = null, $preferColumnCondition = true)

If a prior criterion exists, the condition is "OR"ed to it.

Criteria addUsingOperator(string|AbstractCriterion $p1, mixed $value = null, string $operator = null, boolean $preferColumnCondition = true)

Overrides Criteria::add() to use the default combine operator

string createSelectSql(array $params)

Method to create an SQL query based on values in a Criteria.

mixed doInsert(ConnectionInterface $con = null)

Method to perform inserts based on values and keys in a Criteria.

getPrimaryKey(Criteria $criteria = null)

int doUpdate(Criteria $updateValues, ConnectionInterface $con)

Method used to update rows in the DB.

buildParams($columns, Criteria $values = null)

doCount($con = null)

needsSelectAliases()

Checks whether the Criteria needs to use column aliasing This is implemented in a service class rather than in Criteria itself in order to avoid doing the tests when it's not necessary (e.g.

int doDelete(ConnectionInterface $con = null)

Issue a DELETE query based on the current ModelCriteria This method is called by ModelCriteria::delete() inside a transaction

DataFetcherInterface doSelect($con $con = null)

Builds, binds and executes a SELECT query based on the current object.

_or()

_and()

PropelConditionalProxy|Criteria _if(boolean $cond)

Returns the current object if the condition is true, or a PropelConditionalProxy instance otherwise.

PropelConditionalProxy|Criteria _elseif(boolean $cond)

Returns a PropelConditionalProxy instance.

PropelConditionalProxy|Criteria _else()

Returns a PropelConditionalProxy instance.

Criteria _endif()

Returns the current object Allows for conditional statements in a fluid interface.

__clone()

Ensures deep cloning of attached objects

Details

at line 263
public __construct(String $dbName = null)

Creates a new instance with the default capacity which corresponds to the specified database.

Parameters

String $dbName The database name.

at line 273
public array getMap()

Get the criteria map, i.e.

the array of Criterions

Return Value

array

at line 284
public void clear()

Brings this criteria back to its initial state, so that it can be reused as if it was new.

Except if the criteria has grown in
capacity, it is left at the current capacity.

Return Value

void

at line 322
public Criteria addAsColumn(string $name, string $clause)

Add an AS clause to the select columns.

Usage:

<code>
Criteria myCrit = new Criteria();
myCrit->addAsColumn('alias', 'ALIAS('.MyTableMap::ID.')');
</code>

If the name already exists, it is replaced by the new clause.

Parameters

string $name Wanted Name of the column (alias).
string $clause SQL clause to select from the table

Return Value

Criteria A modified Criteria object.

at line 335
public array getAsColumns()

Get the column aliases.

Return Value

array An assoc array which map the column alias names to the alias clauses.

at line 346
public string getColumnForAs($as)

Returns the column name associated with an alias (AS-column).

Parameters

$as

Return Value

string $string

at line 362
public Criteria addAlias(string $alias, string $table)

Allows one to specify an alias for a table that can be used in various parts of the SQL.

Parameters

string $alias
string $table

Return Value

Criteria A modified Criteria object.

at line 376
public Criteria removeAlias(string $alias)

Remove an alias for a table (useful when merging Criterias).

Parameters

string $alias

Return Value

Criteria A modified Criteria object.

at line 388
public array getAliases()

Returns the aliases for this Criteria

Return Value

array

at line 399
public string getTableForAlias(string $alias)

Returns the table name associated with an alias.

Parameters

string $alias

Return Value

string $string

at line 414
public array($tableName, getTableNameAndAlias(string $tableAliasOrName)

Returns the table name and alias based on a table alias or name.

Use this method to get the details of a table name that comes in a clause,
which can be either a table name or an alias name.

Parameters

string $tableAliasOrName

Return Value

array($tableName, $tableAlias)

at line 432
public array keys()

Get the keys of the criteria map, i.e.

the list of columns bearing a condition
<code>
print_r($c->keys());
=> array('book.price', 'book.title', 'author.first_name')
</code>

Return Value

array

at line 443
public boolean containsKey(string $column)

Does this Criteria object contain the specified key?

Parameters

string $column [table.]column

Return Value

boolean True if this Criteria object contain the specified key.

at line 456
public boolean keyContainsValue(string $column)

Does this Criteria object contain the specified key and does it have a value set for the key

Parameters

string $column [table.]column

Return Value

boolean True if this Criteria object contain the specified key and a value for that key

at line 471
public boolean hasWhereClause()

Whether this Criteria has any where columns.

This counts conditions added with the add() method.

Return Value

boolean

See also

add()

at line 483
public void setUseTransaction($v)

Will force the sql represented by this criteria to be executed within a transaction.

This is here primarily to support the oid type in
postgresql. Though it can be used to require any single sql statement
to use a transaction.

Parameters

$v

Return Value

void

at line 494
public boolean isUseTransaction()

Whether the sql command specified by this criteria must be wrapped in a transaction.

Return Value

boolean

at line 508
public AbstractCriterion getCriterion(string $column)

Method to return criteria related to columns in a table.

Make sure you call containsKey($column) prior to calling this method,
since no check on the existence of the $column is made in this method.

Parameters

string $column Column name.

Return Value

AbstractCriterion A Criterion object.

at line 518
public AbstractCriterion getLastCriterion()

Method to return the latest Criterion in a table.

Return Value

AbstractCriterion A Criterion or null no Criterion is added.

at line 539
public AbstractCriterion getNewCriterion(string $column, mixed $value = null, string $comparison = self::EQUAL)

Method to return a Criterion that is not added automatically to this Criteria.

This can be used to chain the
Criterions to form a more complex where clause.

Parameters

string $column Full name of column (for example TABLE.COLUMN).
mixed $value
string $comparison Criteria comparison constant or PDO binding type

Return Value

AbstractCriterion

at line 577
public string getColumnName(string $name)

Method to return a String table name.

Parameters

string $name Name of the key.

Return Value

string The value of the object at key.

at line 598
public array getTablesColumns()

Shortcut method to get an array of columns indexed by table.

<code>
print_r($c->getTablesColumns());
=> array(
'book' => array('book.price', 'book.title'),
'author' => array('author.first_name')
)
</code>

Return Value

array array(table => array(table.column1, table.column2))

at line 615
public string getComparison(string $key)

Method to return a comparison String.

Parameters

string $key String name of the key.

Return Value

string A String with the value of the object at key.

at line 629
public string getDbName()

Get the Database(Map) name.

Return Value

string A String with the Database(Map) name.

at line 641
public void setDbName(string $dbName = null)

Set the DatabaseMap name.

If <code>null</code> is supplied, uses value
provided by <code>Configuration::getDefaultDatasource()</code>.

Parameters

string $dbName The Database (Map) name.

Return Value

void

at line 655
public string getPrimaryTableName()

Get the primary table for this Criteria.

This is useful for cases where a Criteria may not contain
any SELECT columns or WHERE columns. This must be explicitly
set, of course, in order to be useful.

Return Value

string

at line 669
public setPrimaryTableName($tableName)

Sets the primary table for this Criteria.

This is useful for cases where a Criteria may not contain
any SELECT columns or WHERE columns. This must be explicitly
set, of course, in order to be useful.

Parameters

$tableName

at line 680
public string getTableName(string $name)

Method to return a String table name.

Parameters

string $name The name of the key.

Return Value

string The value of table for criterion at key.

at line 695
public mixed getValue(string $name)

Method to return the value that was added to Criteria.

Parameters

string $name A String with the name of the key.

Return Value

mixed The value of object at key.

at line 710
public mixed get(string $key)

An alias to getValue() -- exposing a Hashtable-like interface.

Parameters

string $key An Object.

Return Value

mixed The value within the Criterion (not the Criterion object).

at line 729
public Instance put(string $key, mixed $value)

Overrides Hashtable put, so that this object is returned instead of the value previously in the Criteria object.

The reason is so that it more closely matches the behavior
of the add() methods. If you want to get the previous value
then you should first Criteria.get() it yourself. Note, if
you attempt to pass in an Object that is not a String, it will
throw a NPE. The reason for this is that none of the add()
methods support adding anything other than a String as a key.

Parameters

string $key
mixed $value

Return Value

Instance of self.

at line 744
public putAll(mixed $t)

Copies all of the mappings from the specified Map to this Criteria These mappings will replace any mappings that this Criteria had for any of the keys currently in the specified Map.

if the map was another Criteria, its attributes are copied to this
Criteria, overwriting previous settings.

Parameters

mixed $t Mappings to be stored in this map.

at line 780
public A add($p1, $value = null, $comparison = null)

This method adds a new criterion to the list of criterias.

If a criterion for the requested column already exists, it is
replaced. If is used as follow:

<code>
$crit = new Criteria();
$crit->add($column, $value, Criteria::GREATER_THAN);
</code>

Any comparison can be used.

The name of the table must be used implicitly in the column name,
so the Column name must be something like 'TABLE.id'.

Parameters

$p1
$value
$comparison

Return Value

A modified Criteria object.

at line 794
public string __toString()

Return Value

string

at line 822
public A addCond(string $name, string $p1, mixed $value = null, string $comparison = null)

This method creates a new criterion but keeps it for later use with combine() Until combine() is called, the condition is not added to the query

<code>
$crit = new Criteria();
$crit->addCond('cond1', $column1, $value1, Criteria::GREATER_THAN);
$crit->addCond('cond2', $column2, $value2, Criteria::EQUAL);
$crit->combine(array('cond1', 'cond2'), Criteria::LOGICAL_OR);
</code>

Any comparison can be used.

The name of the table must be used implicitly in the column name,
so the Column name must be something like 'TABLE.id'.

Parameters

string $name name to combine the criterion later
string $p1 The column to run the comparison on, or AbstractCriterion object.
mixed $value
string $comparison A String.

Return Value

A modified Criteria object.

at line 836
public combine(array $criterions = array(), string $operator = self::LOGICAL_AND, string $name = null)

Combine several named criterions with a logical operator

Parameters

array $criterions array of the name of the criterions to combine
string $operator logical operator, either Criteria::LOGICAL_AND, or Criteria::LOGICAL_OR
string $name optional name to combine the criterion later

at line 877
public Criteria addJoin(mixed $left, mixed $right, mixed $joinType = null)

This is the way that you should add a join of two tables.

Example usage:
<code>
$c->addJoin(ProjectTableMap::ID, FooTableMap::PROJECT_ID, Criteria::LEFT_JOIN);
// LEFT JOIN FOO ON (PROJECT.ID = FOO.PROJECT_ID)
</code>

Parameters

mixed $left A String with the left side of the join.
mixed $right A String with the right side of the join.
mixed $joinType A String with the join operator among Criteria::INNER_JOIN, Criteria::LEFT_JOIN, and Criteria::RIGHT_JOIN

Return Value

Criteria A modified Criteria object.

at line 934
public Criteria addMultipleJoin(array $conditions, string $joinType = null)

Add a join with multiple conditions

Parameters

array $conditions An array of conditions, each condition being an array (left, right, operator)
string $joinType A String with the join operator. Defaults to an implicit join.

Return Value

Criteria A modified Criteria object.

See also

http://propel.phpdb.org/trac/ticket/167, http://propel.phpdb.org/trac/ticket/606 Example usage: $c->addMultipleJoin(array( array(LeftTableMap::LEFT_COLUMN, RightTableMap::RIGHT_COLUMN), // if no third argument, defaults to Criteria::EQUAL array(FoldersTableMap::alias( 'fo', FoldersTableMap::LFT ), FoldersTableMap::alias( 'parent', FoldersTableMap::RGT ), Criteria::LESS_EQUAL ) ), Criteria::LEFT_JOIN );
addJoin()

at line 993
public Criteria addJoinObject(Join $join)

Add a join object to the Criteria

Parameters

Join $join A join object

Return Value

Criteria A modified Criteria object

at line 1006
public array getJoins()

Get the array of Joins.

Return Value

array Join[]

at line 1019
public Criteria addSelectQuery(Criteria $subQueryCriteria, string $alias = null)

Adds a Criteria as subQuery in the From Clause.

Parameters

Criteria $subQueryCriteria Criteria to build the subquery from
string $alias alias for the subQuery

Return Value

Criteria this modified Criteria object (Fluid API)

at line 1034
public boolean hasSelectQueries()

Checks whether this Criteria has a subquery.

Return Value

boolean

at line 1044
public array getSelectQueries()

Get the associative array of Criteria for the subQueries per alias.

Return Value

array Criteria[]

at line 1055
public Criteria getSelectQuery(string $alias)

Get the Criteria for a specific subQuery.

Parameters

string $alias alias for the subQuery

Return Value

Criteria

at line 1066
public boolean hasSelectQuery(string $alias)

checks if the Criteria for a specific subQuery is set.

Parameters

string $alias alias for the subQuery

Return Value

boolean

at line 1071
public forgeSelectQueryAlias()

at line 1085
public Criteria setAll()

Adds 'ALL' modifier to the SQL statement.

Return Value

Criteria Modified Criteria object (for fluent API)

at line 1097
public Criteria setDistinct()

Adds 'DISTINCT' modifier to the SQL statement.

Return Value

Criteria Modified Criteria object (for fluent API)

at line 1113
public Criteria addSelectModifier(string $modifier)

Adds a modifier to the SQL statement.

e.g. self::ALL, self::DISTINCT, 'SQL_CALC_FOUND_ROWS', 'HIGH_PRIORITY', etc.

Parameters

string $modifier The modifier to add

Return Value

Criteria Modified Criteria object (for fluent API)

at line 1131
public Criteria removeSelectModifier(string $modifier)

Removes a modifier to the SQL statement.

Checks for existence before removal

Parameters

string $modifier The modifier to add

Return Value

Criteria Modified Criteria object (for fluent API)

at line 1145
public boolean hasSelectModifier(string $modifier)

Checks the existence of a SQL select modifier

Parameters

string $modifier The modifier to add

Return Value

boolean

at line 1156
public Criteria setIgnoreCase(boolean $b)

Sets ignore case.

Parameters

boolean $b True if case should be ignored.

Return Value

Criteria Modified Criteria object (for fluent API)

at line 1168
public boolean isIgnoreCase()

Is ignore case on or off?

Return Value

boolean True if case is ignored.

at line 1185
public Criteria setSingleRecord(boolean $b)

Set single record? Set this to <code>true</code> if you expect the query to result in only a single result record (the default behaviour is to throw a PropelException if multiple records are returned when the query is executed).

This should be used in situations where returning multiple
rows would indicate an error of some sort. If your query might return
multiple records but you are only interested in the first one then you
should be using setLimit(1).

Parameters

boolean $b Set to TRUE if you expect the query to select just one record.

Return Value

Criteria Modified Criteria object (for fluent API)

at line 1197
public boolean isSingleRecord()

Is single record?

Return Value

boolean True if a single record is being returned.

at line 1208
public Criteria setLimit(int $limit)

Set limit.

Parameters

int $limit An int with the value for limit.

Return Value

Criteria Modified Criteria object (for fluent API)

at line 1221
public int getLimit()

Get limit.

Return Value

int An int with the value for limit.

at line 1233
public Criteria setOffset(int $offset)

Set offset.

Parameters

int $offset An int with the value for offset. (Note this values is cast to a 32bit integer and may result in truncation)

Return Value

Criteria Modified Criteria object (for fluent API)

at line 1245
public int getOffset()

Get offset.

Return Value

int An int with the value for offset.

at line 1256
public Criteria addSelectColumn(string $name)

Add select column.

Parameters

string $name Name of the select column.

Return Value

Criteria Modified Criteria object (for fluent API)

at line 1269
public Criteria setComment(string $comment = null)

Set the query comment, that appears after the first verb in the SQL query

Parameters

string $comment The comment to add to the query, without comment sign

Return Value

Criteria Modified Criteria object (for fluent API)

at line 1281
public string getComment()

Get the query comment, that appears after the first verb in the SQL query

Return Value

string The comment to add to the query, without comment sign

at line 1295
public boolean hasSelectClause()

Whether this Criteria has any select columns.

This will include columns added with addAsColumn() method.

Return Value

boolean

See also

addAsColumn()
addSelectColumn()

at line 1305
public array getSelectColumns()

Get select columns.

Return Value

array An array with the name of the select columns.

at line 1315
public Criteria clearSelectColumns()

Clears current select columns.

Return Value

Criteria Modified Criteria object (for fluent API)

at line 1327
public An getSelectModifiers()

Get select modifiers.

Return Value

An array with the select modifiers.

at line 1338
public A addGroupByColumn(string $groupBy)

Add group by column name.

Parameters

string $groupBy The name of the column to group by.

Return Value

A modified Criteria object.

at line 1351
public A addAscendingOrderByColumn(string $name)

Add order by column name, explicitly specifying ascending.

Parameters

string $name The name of the column to order by.

Return Value

A modified Criteria object.

at line 1364
public Criteria addDescendingOrderByColumn(string $name)

Add order by column name, explicitly specifying descending.

Parameters

string $name The name of the column to order by.

Return Value

Criteria Modified Criteria object (for fluent API)

at line 1376
public array getOrderByColumns()

Get order by columns.

Return Value

array An array with the name of the order columns.

at line 1386
public Criteria clearOrderByColumns()

Clear the order-by columns.

Return Value

Criteria Modified Criteria object (for fluent API)

at line 1398
public Criteria clearGroupByColumns()

Clear the group-by columns.

Return Value

Criteria

at line 1410
public array getGroupByColumns()

Get group by columns.

Return Value

array

at line 1420
public AbstractCriterion getHaving()

Get Having Criterion.

Return Value

AbstractCriterion A Criterion object that is the having clause.

at line 1431
public mixed remove(string $key)

Remove an object from the criteria.

Parameters

string $key A string with the key to be removed.

Return Value

mixed The removed value.

at line 1449
public string toString()

Build a string representation of the Criteria.

Return Value

string A String with the representation of the Criteria.

at line 1476
public int size()

Returns the size (count) of this criteria.

Return Value

int

at line 1486
public boolean equals($crit)

This method checks another Criteria to see if they contain the same attributes and hashtable entries.

Parameters

$crit

Return Value

boolean

at line 1557
public Criteria mergeWith(Criteria $criteria, string $operator = null)

Add the content of a Criteria to the current Criteria In case of conflict, the current Criteria keeps its properties

Parameters

Criteria $criteria The criteria to read properties from
string $operator The logical operator used to combine conditions Defaults to Criteria::LOGICAL_AND, also accepts Criteria::LOGICAL_OR This parameter is deprecated, use _or() instead

Return Value

Criteria The current criteria object

at line 1652
public A addHaving(mixed $p1, mixed $value = null, mixed $comparison = null)

This method adds a prepared Criterion object to the Criteria as a having clause.

You can get a new, empty Criterion object with the
getNewCriterion() method.

<p>
<code>
$crit = new Criteria();
$c = $crit->getNewCriterion(BaseTableMap::ID, 5, Criteria::LESS_THAN);
$crit->addHaving($c);
</code>

Parameters

mixed $p1 A Criterion, or a SQL clause with a question mark placeholder, or a column name
mixed $value The value to bind in the condition
mixed $comparison A PDO::PARAM_ class constant

Return Value

A modified Criteria object.

at line 1706
public Criteria addAnd($p1, $p2 = null, $p3 = null, $preferColumnCondition = true)

If a criterion for the requested column already exists, the condition is "AND"ed to the existing criterion (necessary for Propel 1.4 compatibility).

If no criterion for the requested column already exists, the condition is "AND"ed to the latest criterion.
If no criterion exist, the condition is added a new criterion

Any comparison can be used.

Supports a number of different signatures:
- addAnd(column, value, comparison)
- addAnd(column, value)
- addAnd(Criterion)

Parameters

$p1
$p2
$p3
$preferColumnCondition

Return Value

Criteria A modified Criteria object.

at line 1736
public Criteria addOr($p1, $p2 = null, $p3 = null, $preferColumnCondition = true)

If a prior criterion exists, the condition is "OR"ed to it.

If no criterion exist, the condition is added a new criterion

Any comparison can be used.

Supports a number of different signatures:
- addOr(column, value, comparison)
- addOr(column, value)
- addOr(Criterion)

Parameters

$p1
$p2
$p3
$preferColumnCondition

Return Value

Criteria A modified Criteria object.

at line 1766
public Criteria addUsingOperator(string|AbstractCriterion $p1, mixed $value = null, string $operator = null, boolean $preferColumnCondition = true)

Overrides Criteria::add() to use the default combine operator

Parameters

string|AbstractCriterion $p1 The column to run the comparison on (e.g. BookTableMap::ID), or Criterion object
mixed $value
string $operator A String, like Criteria::EQUAL.
boolean $preferColumnCondition If true, the condition is combined with an existing condition on the same column (necessary for Propel 1.4 compatibility). If false, the condition is combined with the last existing condition.

Return Value

Criteria A modified Criteria object.

See also

Criteria::add()

at line 1790
public string createSelectSql(array $params)

Method to create an SQL query based on values in a Criteria.

This method creates only prepared statement SQL (using ? where values
will go). The second parameter ($params) stores the values that need
to be set before the statement is executed. The reason we do it this way
is to let the PDO layer handle all escaping & value formatting.

Parameters

array $params &$params Parameters that are to be replaced in prepared statement.

Return Value

string

Exceptions

PropelException Trouble creating the query string.

at line 2007
public mixed doInsert(ConnectionInterface $con = null)

Method to perform inserts based on values and keys in a Criteria.

<p>
If the primary key is auto incremented the data in Criteria
will be inserted and the auto increment value will be returned.
<p>
If the primary key is included in Criteria then that value will
be used to insert the row.
<p>
If no primary key is included in Criteria then we will try to
figure out the primary key from the database map and insert the
row with the next available id using util.db.IDBroker.
<p>
If no primary key is defined for the table the values will be
inserted as specified in Criteria and null will be returned.

Parameters

ConnectionInterface $con A ConnectionInterface connection.

Return Value

mixed The primary key for the new row if the primary key is auto-generated. Otherwise will return null.

Exceptions

PropelException

at line 2103
public getPrimaryKey(Criteria $criteria = null)

Parameters

Criteria $criteria

at line 2147
public int doUpdate(Criteria $updateValues, ConnectionInterface $con)

Method used to update rows in the DB.

Rows are selected based
on selectCriteria and updated using values in updateValues.
<p>
Use this method for performing an update of the kind:
<p>
WHERE some_column = some value AND could_have_another_column =
another value AND so on.

Parameters

Criteria $updateValues A Criteria object containing values used in set clause.
ConnectionInterface $con The ConnectionInterface connection object to use.

Return Value

int The number of rows affected by last update statement. For most uses there is only one update statement executed, so this number will correspond to the number of rows affected by the call to this method. Note that the return value does require that this information is returned (supported) by the Propel db driver.

Exceptions

PropelException

at line 2272
public buildParams($columns, Criteria $values = null)

Parameters

$columns
Criteria $values

at line 2292
public doCount($con = null)

Parameters

$con

at line 2341
public needsSelectAliases()

Checks whether the Criteria needs to use column aliasing This is implemented in a service class rather than in Criteria itself in order to avoid doing the tests when it's not necessary (e.g.

for SELECTs)

at line 2367
public int doDelete(ConnectionInterface $con = null)

Issue a DELETE query based on the current ModelCriteria This method is called by ModelCriteria::delete() inside a transaction

Parameters

ConnectionInterface $con a connection object

Return Value

int the number of deleted rows

Exceptions

PropelException

at line 2429
public DataFetcherInterface doSelect($con $con = null)

Builds, binds and executes a SELECT query based on the current object.

Parameters

$con $con A connection object

Return Value

DataFetcherInterface A dataFetcher using the connection, ready to be fetched

Exceptions

PropelException

at line 2456
public _or()

at line 2463
public _and()

at line 2481
public PropelConditionalProxy|Criteria _if(boolean $cond)

Returns the current object if the condition is true, or a PropelConditionalProxy instance otherwise.

Allows for conditional statements in a fluid interface.

Parameters

boolean $cond

Return Value

PropelConditionalProxy|Criteria

at line 2496
public PropelConditionalProxy|Criteria _elseif(boolean $cond)

Returns a PropelConditionalProxy instance.

Allows for conditional statements in a fluid interface.

Parameters

boolean $cond ignored

Return Value

PropelConditionalProxy|Criteria

at line 2511
public PropelConditionalProxy|Criteria _else()

Returns a PropelConditionalProxy instance.

Allows for conditional statements in a fluid interface.

at line 2526
public Criteria _endif()

Returns the current object Allows for conditional statements in a fluid interface.

Return Value

Criteria

at line 2545
public __clone()

Ensures deep cloning of attached objects