Propel API
Class

ModelCriteria

class ModelCriteria extends Criteria

This class extends the Criteria by adding runtime introspection abilities in order to ease the building of queries.

A ModelCriteria requires additional information to be initialized.
Using a model name and tablemaps, a ModelCriteria can do more powerful things than a simple Criteria

magic methods:

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

MODEL_CLAUSE

MODEL_CLAUSE_ARRAY

MODEL_CLAUSE_LIKE

MODEL_CLAUSE_SEVERAL

MODEL_CLAUSE_RAW

FORMAT_STATEMENT

FORMAT_ARRAY

FORMAT_OBJECT

FORMAT_ON_DEMAND

Methods

__construct(string $dbName = null, string $modelName, string $modelAlias = null)

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

getIterator()

Implementing SPL IteratorAggregate interface.

from Criteria
array getMap()

Get the criteria map, i.e.

from Criteria
ModelCriteria clear()

Clear the conditions to allow the reuse of the query object.

Criteria addAsColumn(string $name, string $clause)

Add an AS clause to the select columns.

from Criteria
array getAsColumns()

Get the column aliases.

from Criteria
string getColumnForAs($as)

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

from Criteria
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.

from Criteria
Criteria removeAlias(string $alias)

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

from Criteria
array getAliases()

Returns the aliases for this Criteria

from Criteria
string getTableForAlias(string $alias)

Returns the table name associated with an alias.

from Criteria
array($tableName, getTableNameAndAlias(string $tableAliasOrName)

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

from Criteria
array keys()

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

from Criteria
boolean containsKey(string $column)

Does this Criteria object contain the specified key?

from Criteria
boolean keyContainsValue(string $column)

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

from Criteria
boolean hasWhereClause()

Whether this Criteria has any where columns.

from Criteria
void setUseTransaction($v)

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

from Criteria
boolean isUseTransaction()

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

from Criteria
Criterion getCriterion(string $column)

Method to return criteria related to columns in a table.

from Criteria
Criterion getLastCriterion()

Method to return the latest Criterion in a table.

from Criteria
Criterion getNewCriterion(string $column, mixed $value = null, string $comparison = self::EQUAL)

Method to return criterion that is not added automatically to this Criteria.

from Criteria
string getColumnName(string $name)

Method to return a String table name.

from Criteria
array getTablesColumns()

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

from Criteria
string getComparison(string $key)

Method to return a comparison String.

from Criteria
string getDbName()

Get the Database(Map) name.

from Criteria
void setDbName(string $dbName = null)

Set the DatabaseMap name.

from Criteria
string getPrimaryTableName()

Get the primary table for this Criteria.

from Criteria
setPrimaryTableName($tableName)

Sets the primary table for this Criteria.

from Criteria
string getTableName(string $name)

Method to return a String table name.

from Criteria
mixed getValue(string $name)

Method to return the value that was added to Criteria.

from Criteria
mixed get(string $key)

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

from Criteria
Instance put(string $key, mixed $value)

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

from Criteria
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.

from Criteria
Criteria add($p1, $value = null, $comparison = null)

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

from Criteria
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

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

Combine several named criterions with a logical operator

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

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

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

Add a join with multiple conditions

from Criteria
ModelCriteria addJoinObject(Join $join, $name = null)

Add a join object to the Criteria

array getJoins()

Get the array of Joins.

from Criteria
ModelCriteria addSelectQuery(Criteria $subQueryCriteria, string $alias = null, boolean $addAliasAndSelectColumns = true)

Adds a Criteria as subQuery in the From Clause.

Boolean hasSelectQueries()

Checks whether this Criteria has a subquery.

from Criteria
array getSelectQueries()

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

from Criteria
Criteria getSelectQuery(string $alias)

Get the Criteria for a specific subQuery.

from Criteria
boolean hasSelectQuery(string $alias)

checks if the Criteria for a specific subQuery is set.

from Criteria
forgeSelectQueryAlias()

from Criteria
Criteria setAll()

Adds "ALL" modifier to the SQL statement.

from Criteria
Criteria setDistinct()

Adds "DISTINCT" modifier to the SQL statement.

from Criteria
Criteria addSelectModifier(string $modifier)

Adds a modifier to the SQL statement.

from Criteria
Criteria removeSelectModifier(string $modifier)

Removes a modifier to the SQL statement.

from Criteria
bool hasSelectModifier(string $modifier)

Checks the existence of a SQL select modifier

from Criteria
Criteria setIgnoreCase(boolean $b)

Sets ignore case.

from Criteria
boolean isIgnoreCase()

Is ignore case on or off?

from Criteria
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).

from Criteria
boolean isSingleRecord()

Is single record?

from Criteria
Criteria setLimit(limit $limit)

Set limit.

from Criteria
int getLimit()

Get limit.

from Criteria
Criteria setOffset(int $offset)

Set offset.

from Criteria
An getOffset()

Get offset.

from Criteria
Criteria addSelectColumn(string $name)

Add select column.

from Criteria
Criteria setComment(string $comment = null)

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

from Criteria
string getComment()

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

from Criteria
boolean hasSelectClause()

Whether this Criteria has any select columns.

from Criteria
array getSelectColumns()

Get select columns.

from Criteria
Criteria clearSelectColumns()

Clears current select columns.

from Criteria
An getSelectModifiers()

Get select modifiers.

from Criteria
A addGroupByColumn(string $groupBy)

Add group by column name.

from Criteria
A addAscendingOrderByColumn(string $name)

Add order by column name, explicitly specifying ascending.

from Criteria
Criteria addDescendingOrderByColumn(string $name)

Add order by column name, explicitly specifying descending.

from Criteria
array getOrderByColumns()

Get order by columns.

from Criteria
Criteria clearOrderByColumns()

Clear the order-by columns.

from Criteria
Criteria clearGroupByColumns()

Clear the group-by columns.

from Criteria
array getGroupByColumns()

Get group by columns.

from Criteria
Criterion getHaving()

Get Having Criterion.

from Criteria
mixed remove(string $key)

Remove an object from the criteria.

from Criteria
string toString()

Build a string representation of the Criteria.

from Criteria
int size()

Returns the size (count) of this criteria.

from Criteria
boolean equals($crit)

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

from Criteria
ModelCriteria 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($p1, $value = null, $comparison = null)

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

from Criteria
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).

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

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

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

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

from Criteria
_or()

from Criteria
_and()

from Criteria
PropelConditionalProxy|Criteria _if(bool $cond)

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

from Criteria
PropelConditionalProxy|Criteria _elseif(bool $cond)

Returns a PropelConditionalProxy instance.

from Criteria
PropelConditionalProxy|Criteria _else()

Returns a PropelConditionalProxy instance.

from Criteria
Criteria _endif()

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

from Criteria
__clone()

Ensures deep cloning of attached objects

string getModelName()

Returns the name of the class for this model criteria

ModelCriteria setModelAlias(string $modelAlias, boolean $useAliasInSQL = false)

Sets the alias for the model in this query

string getModelAlias()

Returns the alias of the main class for this model criteria

string getModelAliasOrName()

Return the string to use in a clause as a model prefix for the main model

string getModelPeerName()

Returns the name of the Peer class for this model criteria

TableMap getTableMap()

Returns the TabkleMap object for this Criteria

ModelCriteria setFormatter(string|PropelFormatter $formatter)

Sets the formatter to use for the find() output Formatters must extend PropelFormatter Use the ModelCriteria constants for class names: <code> $c->setFormatter(ModelCriteria::FORMAT_ARRAY); </code>

PropelFormatter getFormatter()

Gets the formatter to use for the find() output Defaults to an instance of ModelCriteria::$defaultFormatterClass, i.e.

ModelCriteria condition(string $conditionName, string $clause, mixed $value = null, mixed $bindingType = null)

Adds a condition on a column based on a pseudo SQL clause but keeps it for later use with combine() Until combine() is called, the condition is not added to the query Uses introspection to translate the column phpName into a fully qualified name <code> $c->condition('cond1', 'b.Title = ?', 'foo'); </code>

ModelCriteria filterBy(string $column, mixed $value, string $comparison = Criteria::EQUAL)

Adds a condition on a column based on a column phpName and a value Uses introspection to translate the column phpName into a fully qualified name Warning: recognizes only the phpNames of the main Model (not joined tables) <code> $c->filterBy('Title', 'foo'); </code>

ModelCriteria filterByArray(mixed $conditions)

Adds a list of conditions on the columns of the current model Uses introspection to translate the column phpName into a fully qualified name Warning: recognizes only the phpNames of the main Model (not joined tables) <code> $c->filterByArray(array( 'Title' => 'War And Peace', 'Publisher' => $publisher )); </code>

ModelCriteria where($clause, $value = null, $bindingType = null)

Adds a condition on a column based on a pseudo SQL clause Uses introspection to translate the column phpName into a fully qualified name <code> // simple clause $c->where('b.Title = ?', 'foo'); // named conditions $c->condition('cond1', 'b.Title = ?', 'foo'); $c->condition('cond2', 'b.ISBN = ?', 12345); $c->where(array('cond1', 'cond2'), Criteria::LOGICAL_OR); </code>

ModelCriteria orWhere($clause, $value = null, $bindingType = null)

Adds a condition on a column based on a pseudo SQL clause Uses introspection to translate the column phpName into a fully qualified name <code> // simple clause $c->orWhere('b.Title = ?', 'foo'); // named conditions $c->condition('cond1', 'b.Title = ?', 'foo'); $c->condition('cond2', 'b.ISBN = ?', 12345); $c->orWhere(array('cond1', 'cond2'), Criteria::LOGICAL_OR); </code>

ModelCriteria having($clause, $value = null, $bindingType = null)

Adds a having condition on a column based on a pseudo SQL clause Uses introspection to translate the column phpName into a fully qualified name <code> // simple clause $c->having('b.Title = ?', 'foo'); // named conditions $c->condition('cond1', 'b.Title = ?', 'foo'); $c->condition('cond2', 'b.ISBN = ?', 12345); $c->having(array('cond1', 'cond2'), Criteria::LOGICAL_OR); </code>

ModelCriteria orderBy(string $columnName, string $order = Criteria::ASC)

Adds an ORDER BY clause to the query Usability layer on top of Criteria::addAscendingOrderByColumn() and Criteria::addDescendingOrderByColumn() Infers $column and $order from $columnName and some optional arguments Examples: $c->orderBy('Book.CreatedAt') => $c->addAscendingOrderByColumn(BookPeer::CREATED_AT) $c->orderBy('Book.CategoryId', 'desc') => $c->addDescendingOrderByColumn(BookPeer::CATEGORY_ID)

ModelCriteria groupBy(string $columnName)

Adds a GROUB BY clause to the query Usability layer on top of Criteria::addGroupByColumn() Infers $column $columnName Examples: $c->groupBy('Book.AuthorId') => $c->addGroupByColumn(BookPeer::AUTHOR_ID)

ModelCriteria groupByClass(string $class)

Adds a GROUB BY clause for all columns of a model to the query Examples: $c->groupBy('Book'); => $c->addGroupByColumn(BookPeer::ID); => $c->addGroupByColumn(BookPeer::TITLE); => $c->addGroupByColumn(BookPeer::AUTHOR_ID); => $c->addGroupByColumn(BookPeer::PUBLISHER_ID);

ModelCriteria distinct()

Adds a DISTINCT clause to the query Alias for Criteria::setDistinct()

ModelCriteria limit(int $limit)

Adds a LIMIT clause (or its subselect equivalent) to the query Alias for Criteria:::setLimit()

ModelCriteria offset(int $offset)

Adds an OFFSET clause (or its subselect equivalent) to the query Alias for of Criteria::setOffset()

ModelCriteria select(mixed $columnArray)

Makes the ModelCriteria return a string, array, or PropelArrayCollection Examples: ArticleQuery::create()->select('Name')->find(); => PropelArrayCollection Object ('Foo', 'Bar')

array|string getSelect()

Retrieves the columns defined by a previous call to select().

Join getPreviousJoin()

This method returns the previousJoin for this ModelCriteria, by default this is null, but after useQuery this is set the to the join of that use

setPreviousJoin(Join $previousJoin)

This method sets the previousJoin for this ModelCriteria, by default this is null, but after useQuery this is set the to the join of that use

Join getJoin(string $name)

This method returns an already defined join clause from the query

ModelCriteria join(string $relation, string $joinType = Criteria::INNER_JOIN)

Adds a JOIN clause to the query Infers the ON clause from a relation name Uses the Propel table maps, based on the schema, to guess the related columns Beware that the default JOIN operator is INNER JOIN, while Criteria defaults to WHERE Examples: <code> $c->join('Book.Author'); => $c->addJoin(BookPeer::AUTHOR_ID, AuthorPeer::ID, Criteria::INNER_JOIN); $c->join('Book.Author', Criteria::RIGHT_JOIN); => $c->addJoin(BookPeer::AUTHOR_ID, AuthorPeer::ID, Criteria::RIGHT_JOIN); $c->join('Book.Author a', Criteria::RIGHT_JOIN); => $c->addAlias('a', AuthorPeer::TABLE_NAME); => $c->addJoin(BookPeer::AUTHOR_ID, 'a.ID', Criteria::RIGHT_JOIN); </code>

ModelCriteria addJoinCondition($name, $clause, $value = null, $operator = null, $bindingType = null)

Add another condition to an already added join

ModelCriteria setJoinCondition(string $name, mixed $condition)

Replace the condition of an already added join

ModelCriteria joinWith(string $relation, string $joinType = Criteria::INNER_JOIN)

Adds a JOIN clause to the query and hydrates the related objects Shortcut for $c->join()->with() <code> $c->joinWith('Book.Author'); => $c->join('Book.Author'); => $c->with('Author'); $c->joinWith('Book.Author a', Criteria::RIGHT_JOIN); => $c->join('Book.Author a', Criteria::RIGHT_JOIN); => $c->with('a'); </code>

ModelCriteria with(string $relation)

Adds a relation to hydrate together with the main object The relation must be initialized via a join() prior to calling with() Examples: <code> $c->join('Book.Author'); $c->with('Author');

array getWith()

Gets the array of ModelWith specifying which objects must be hydrated together with the main object.

ModelCriteria setWith(array $with)

Sets the array of ModelWith specifying which objects must be hydrated together with the main object.

isWithOneToMany()

ModelCriteria withColumn(string $clause, string $name = null)

Adds a supplementary column to the select clause These columns can later be retrieved from the hydrated objects using getVirtualColumn()

ModelCriteria useQuery($relationName, $secondaryCriteriaClass = null)

Initializes a secondary ModelCriteria object, to be later merged with the current object

ModelCriteria endUse()

Finalizes a secondary criteria and merges it with its primary Criteria

setPrimaryCriteria(ModelCriteria $criteria, Join $previousJoin)

Sets the primary Criteria for this secondary Criteria

ModelCriteria getPrimaryCriteria()

Gets the primary criteria for this secondary Criteria

ModelCriteria addSelfSelectColumns()

Adds the select columns for a the current table

ModelCriteria addRelationSelectColumns(string $relation)

Adds the select columns for a relation

static array getClassAndAlias(string $class)

Returns the class and alias of a string representing a model or a relation e.g.

static string getRelationName(string $relation)

Returns the name of a relation from a string.

ModelCriteria keepQuery(boolean $isKeepQuery = true)

Triggers the automated cloning on termination.

boolean isKeepQuery()

Checks whether the automated cloning on termination is enabled.

PropelObjectCollection|array|mixed find(PropelPDO $con = null)

Issue a SELECT query based on the current ModelCriteria and format the list of results with the current formatter By default, returns an array of model objects

mixed findOne(PropelPDO $con = null)

Issue a SELECT ...

mixed findOneOrCreate(PropelPDO $con = null)

Issue a SELECT ...

mixed findPk(mixed $key, PropelPDO $con = null)

Find object by primary key Behaves differently if the model has simple or composite primary key <code> // simple primary key $book = $c->findPk(12, $con); // composite primary key $bookOpinion = $c->findPk(array(34, 634), $con); </code>

mixed findPks(array $keys, PropelPDO $con = null)

Find objects by primary key Behaves differently if the model has simple or composite primary key <code> // simple primary key $books = $c->findPks(array(12, 56, 832), $con); // composite primary key $bookOpinion = $c->findPks(array(array(34, 634), array(45, 518), array(34, 765)), $con); </code>

mixed findBy(string $column, mixed $value, PropelPDO $con = null)

Apply a condition on a column and issues the SELECT query

mixed findByArray(mixed $conditions, PropelPDO $con = null)

Apply a list of conditions on columns and issues the SELECT query <code> $c->findByArray(array( 'Title' => 'War And Peace', 'Publisher' => $publisher ), $con); </code>

mixed findOneBy(mixed $column, mixed $value, PropelPDO $con = null)

Apply a condition on a column and issues the SELECT ...

mixed findOneByArray(mixed $conditions, PropelPDO $con = null)

Apply a list of conditions on columns and issues the SELECT ...

integer count(PropelPDO $con = null)

Issue a SELECT COUNT(*) query based on the current ModelCriteria

PropelModelPager paginate(int $page = 1, int $maxPerPage = 10, PropelPDO $con = null)

Issue a SELECT query based on the current ModelCriteria and uses a page and a maximum number of results per page to compute an offet and a limit.

integer delete(PropelPDO $con = null)

Issue a DELETE query based on the current ModelCriteria An optional hook on basePreDelete() can prevent the actual deletion

integer doDelete(PropelPDO $con)

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

integer deleteAll(PropelPDO $con = null)

Issue a DELETE query based on the current ModelCriteria deleting all rows in the table An optional hook on basePreDelete() can prevent the actual deletion

integer doDeleteAll(PropelPDO $con)

Issue a DELETE query based on the current ModelCriteria deleting all rows in the table This method is called by ModelCriteria::deleteAll() inside a transaction

Integer update(array $values, PropelPDO $con = null, boolean $forceIndividualSaves = false)

Issue an UPDATE query based the current ModelCriteria and a list of changes.

Integer doUpdate(array $values, PropelPDO $con, boolean $forceIndividualSaves = false)

Issue an UPDATE query based the current ModelCriteria and a list of changes.

string getAliasedColName(string $colName)

Changes the table part of a a fully qualified column name if a true model alias exists e.g.

ModelCriteria addUsingAlias($p1, $value = null, $operator = null)

Overrides Criteria::add() to force the use of a true table alias if it exists

array getParams()

Get all the parameters to bind to this criteria Does part of the job of BasePeer::createSelectSql() for the cache

__call($name, $arguments)

Handle the magic Supports findByXXX(), findOneByXXX(), filterByXXX(), orderByXXX(), and groupByXXX() methods, where XXX is a column phpName.

Details

at line 63
public __construct(string $dbName = null, string $modelName, string $modelAlias = null)

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

Parameters

string $dbName The dabase name
string $modelName The phpName of a model, e.g. 'Book'
string $modelAlias The alias for the model in this query, e.g. 'b'

in Criteria at line 261
public getIterator()

Implementing SPL IteratorAggregate interface.

This allows
you to foreach () over a Criteria object.

in Criteria at line 270
public array getMap()

Get the criteria map, i.e.

the array of Criterions

Return Value

array

at line 952
public ModelCriteria clear()

Clear the conditions to allow the reuse of the query object.

The ModelCriteria's Model and alias 'all the properties set by construct) will remain.

Return Value

ModelCriteria The primary criteria object

in Criteria at line 320
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(".MyPeer::ID.")");
</code>

Parameters

string $name Wanted Name of the column (alias).
string $clause SQL clause to select from the table If the name already exists, it is replaced by the new clause.

Return Value

Criteria A modified Criteria object.

in Criteria at line 332
public array getAsColumns()

Get the column aliases.

Return Value

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

in Criteria at line 343
public string getColumnForAs($as)

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

Parameters

$as

Return Value

string $string

in Criteria at line 359
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.

in Criteria at line 373
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.

in Criteria at line 385
public array getAliases()

Returns the aliases for this Criteria

Return Value

array

in Criteria at line 396
public string getTableForAlias(string $alias)

Returns the table name associated with an alias.

Parameters

string $alias

Return Value

string $string

in Criteria at line 411
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)

in Criteria at line 429
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

in Criteria at line 440
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.

in Criteria at line 453
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

in Criteria at line 468
public boolean hasWhereClause()

Whether this Criteria has any where columns.

This counts conditions added with the add() method.

Return Value

boolean

See also

add()

in Criteria at line 480
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

in Criteria at line 491
public boolean isUseTransaction()

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

Return Value

boolean

in Criteria at line 505
public Criterion 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

Criterion A Criterion object.

in Criteria at line 515
public Criterion getLastCriterion()

Method to return the latest Criterion in a table.

Return Value

Criterion A Criterion or null no Criterion is added.

in Criteria at line 534
public Criterion getNewCriterion(string $column, mixed $value = null, string $comparison = self::EQUAL)

Method to return 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

Return Value

Criterion

in Criteria at line 545
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.

in Criteria at line 565
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))

in Criteria at line 581
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.

in Criteria at line 594
public string getDbName()

Get the Database(Map) name.

Return Value

string A String with the Database(Map) name.

in Criteria at line 606
public void setDbName(string $dbName = null)

Set the DatabaseMap name.

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

Parameters

string $dbName The Database (Map) name.

Return Value

void

in Criteria at line 620
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

in Criteria at line 634
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

in Criteria at line 645
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.

in Criteria at line 659
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.

in Criteria at line 673
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).

in Criteria at line 692
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.

in Criteria at line 707
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.

in Criteria at line 743
public Criteria 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

Criteria A modified Criteria object.

in Criteria at line 778
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 Criterion object.
mixed $value
string $comparison A String.

Return Value

A modified Criteria object.

in Criteria at line 792
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

in Criteria at line 833
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(ProjectPeer::ID, FooPeer::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.

in Criteria at line 888
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(LeftPeer::LEFT_COLUMN, RightPeer::RIGHT_COLUMN), // if no third argument, defaults to Criteria::EQUAL array(FoldersPeer::alias( 'fo', FoldersPeer::LFT ), FoldersPeer::alias( 'parent', FoldersPeer::RGT ), Criteria::LESS_EQUAL ) ), Criteria::LEFT_JOIN );
addJoin()

at line 736
public ModelCriteria addJoinObject(Join $join, $name = null)

Add a join object to the Criteria

Parameters

Join $join
$name

Return Value

ModelCriteria The current object, for fluid interface

See also

Criteria::addJoinObject()

in Criteria at line 954
public array getJoins()

Get the array of Joins.

Return Value

array Join[]

at line 995
public ModelCriteria addSelectQuery(Criteria $subQueryCriteria, string $alias = null, boolean $addAliasAndSelectColumns = true)

Adds a Criteria as subQuery in the From Clause.

Parameters

Criteria $subQueryCriteria Criteria to build the subquery from
string $alias alias for the subQuery
boolean $addAliasAndSelectColumns Set to false if you want to manually add the aliased select columns

Return Value

ModelCriteria The current object, for fluid interface

See also

Criteria::addSelectQuery()

in Criteria at line 982
public Boolean hasSelectQueries()

Checks whether this Criteria has a subquery.

Return Value

Boolean

in Criteria at line 992
public array getSelectQueries()

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

Return Value

array Criteria[]

in Criteria at line 1003
public Criteria getSelectQuery(string $alias)

Get the Criteria for a specific subQuery.

Parameters

string $alias alias for the subQuery

Return Value

Criteria

in Criteria at line 1014
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

in Criteria at line 1019
public forgeSelectQueryAlias()

in Criteria at line 1032
public Criteria setAll()

Adds "ALL" modifier to the SQL statement.

Return Value

Criteria Modified Criteria object (for fluent API)

in Criteria at line 1044
public Criteria setDistinct()

Adds "DISTINCT" modifier to the SQL statement.

Return Value

Criteria Modified Criteria object (for fluent API)

in Criteria at line 1060
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)

in Criteria at line 1078
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)

in Criteria at line 1092
public bool hasSelectModifier(string $modifier)

Checks the existence of a SQL select modifier

Parameters

string $modifier The modifier to add

Return Value

bool

in Criteria at line 1103
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)

in Criteria at line 1114
public boolean isIgnoreCase()

Is ignore case on or off?

Return Value

boolean True if case is ignored.

in Criteria at line 1131
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)

in Criteria at line 1142
public boolean isSingleRecord()

Is single record?

Return Value

boolean True if a single record is being returned.

in Criteria at line 1153
public Criteria setLimit(limit $limit)

Set limit.

Parameters

limit $limit An int with the value for limit.

Return Value

Criteria Modified Criteria object (for fluent API)

in Criteria at line 1165
public int getLimit()

Get limit.

Return Value

int An int with the value for limit.

in Criteria at line 1177
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 truncatation)

Return Value

Criteria Modified Criteria object (for fluent API)

in Criteria at line 1188
public An getOffset()

Get offset.

Return Value

An int with the value for offset.

in Criteria at line 1199
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)

in Criteria at line 1211
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)

in Criteria at line 1223
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

in Criteria at line 1237
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()

in Criteria at line 1247
public array getSelectColumns()

Get select columns.

Return Value

array An array with the name of the select columns.

in Criteria at line 1257
public Criteria clearSelectColumns()

Clears current select columns.

Return Value

Criteria Modified Criteria object (for fluent API)

in Criteria at line 1268
public An getSelectModifiers()

Get select modifiers.

Return Value

An array with the select modifiers.

in Criteria at line 1279
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.

in Criteria at line 1291
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.

in Criteria at line 1303
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)

in Criteria at line 1314
public array getOrderByColumns()

Get order by columns.

Return Value

array An array with the name of the order columns.

in Criteria at line 1324
public Criteria clearOrderByColumns()

Clear the order-by columns.

Return Value

Criteria Modified Criteria object (for fluent API)

in Criteria at line 1335
public Criteria clearGroupByColumns()

Clear the group-by columns.

Return Value

Criteria

in Criteria at line 1346
public array getGroupByColumns()

Get group by columns.

Return Value

array

in Criteria at line 1356
public Criterion getHaving()

Get Having Criterion.

Return Value

Criterion A Criterion object that is the having clause.

in Criteria at line 1367
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.

in Criteria at line 1384
public string toString()

Build a string representation of the Criteria.

Return Value

string A String with the representation of the Criteria.

in Criteria at line 1412
public int size()

Returns the size (count) of this criteria.

Return Value

int

in Criteria at line 1422
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 934
public ModelCriteria 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 accapts Criteria::LOGICAL_OR

Return Value

ModelCriteria The primary criteria object

See also

Criteria::mergeWith()

in Criteria at line 1578
public A addHaving($p1, $value = null, $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(BasePeer::ID, 5, Criteria::LESS_THAN);
$crit->addHaving($c);
</code>

Parameters

$p1
$value
$comparison

Return Value

A modified Criteria object.

in Criteria at line 1636
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.

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

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

If no criterion for the requested column already exists, the condition is "OR"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:
- addOr(column, value, comparison)
- addOr(column, value)
- addOr(Criterion)

Parameters

$p1
$p2
$p3
$preferColumnCondition

Return Value

Criteria A modified Criteria object.

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

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

Parameters

string|Criterion $p1 The column to run the comparison on (e.g. BookPeer::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()

in Criteria at line 1717
public _or()

in Criteria at line 1724
public _and()

in Criteria at line 1742
public PropelConditionalProxy|Criteria _if(bool $cond)

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

Allows for conditional statements in a fluid interface.

Parameters

bool $cond

Return Value

PropelConditionalProxy|Criteria

in Criteria at line 1756
public PropelConditionalProxy|Criteria _elseif(bool $cond)

Returns a PropelConditionalProxy instance.

Allows for conditional statements in a fluid interface.

Parameters

bool $cond ignored

Return Value

PropelConditionalProxy|Criteria

in Criteria at line 1771
public PropelConditionalProxy|Criteria _else()

Returns a PropelConditionalProxy instance.

Allows for conditional statements in a fluid interface.

in Criteria at line 1786
public Criteria _endif()

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

Return Value

Criteria

at line 2145
public __clone()

Ensures deep cloning of attached objects

at line 78
public string getModelName()

Returns the name of the class for this model criteria

Return Value

string

at line 91
public ModelCriteria setModelAlias(string $modelAlias, boolean $useAliasInSQL = false)

Sets the alias for the model in this query

Parameters

string $modelAlias The model alias
boolean $useAliasInSQL Whether to use the alias in the SQL code (false by default)

Return Value

ModelCriteria The current object, for fluid interface

at line 107
public string getModelAlias()

Returns the alias of the main class for this model criteria

Return Value

string The model alias

at line 117
public string getModelAliasOrName()

Return the string to use in a clause as a model prefix for the main model

Return Value

string The model alias if it exists, the model name if not

at line 127
public string getModelPeerName()

Returns the name of the Peer class for this model criteria

Return Value

string

at line 137
public TableMap getTableMap()

Returns the TabkleMap object for this Criteria

Return Value

TableMap

at line 153
public ModelCriteria setFormatter(string|PropelFormatter $formatter)

Sets the formatter to use for the find() output Formatters must extend PropelFormatter Use the ModelCriteria constants for class names: <code> $c->setFormatter(ModelCriteria::FORMAT_ARRAY); </code>

Parameters

string|PropelFormatter $formatter a formatter class name, or a formatter instance

Return Value

ModelCriteria The current object, for fluid interface

at line 172
public PropelFormatter getFormatter()

Gets the formatter to use for the find() output Defaults to an instance of ModelCriteria::$defaultFormatterClass, i.e.

PropelObjectsFormatter

Return Value

PropelFormatter

at line 199
public ModelCriteria condition(string $conditionName, string $clause, mixed $value = null, mixed $bindingType = null)

Adds a condition on a column based on a pseudo SQL clause but keeps it for later use with combine() Until combine() is called, the condition is not added to the query Uses introspection to translate the column phpName into a fully qualified name <code> $c->condition('cond1', 'b.Title = ?', 'foo'); </code>

Parameters

string $conditionName A name to store the condition for a later combination with combine()
string $clause The pseudo SQL clause, e.g. 'AuthorId = ?'
mixed $value A value for the condition
mixed $bindingType A value for the condition

Return Value

ModelCriteria The current object, for fluid interface

See also

Criteria::add()

at line 222
public ModelCriteria filterBy(string $column, mixed $value, string $comparison = Criteria::EQUAL)

Adds a condition on a column based on a column phpName and a value Uses introspection to translate the column phpName into a fully qualified name Warning: recognizes only the phpNames of the main Model (not joined tables) <code> $c->filterBy('Title', 'foo'); </code>

Parameters

string $column A string representing thecolumn phpName, e.g. 'AuthorId'
mixed $value A value for the condition
string $comparison What to use for the column comparison, defaults to Criteria::EQUAL

Return Value

ModelCriteria The current object, for fluid interface

See also

Criteria::add()

at line 244
public ModelCriteria filterByArray(mixed $conditions)

Adds a list of conditions on the columns of the current model Uses introspection to translate the column phpName into a fully qualified name Warning: recognizes only the phpNames of the main Model (not joined tables) <code> $c->filterByArray(array( 'Title' => 'War And Peace', 'Publisher' => $publisher )); </code>

Parameters

mixed $conditions An array of conditions, using column phpNames as key

Return Value

ModelCriteria The current object, for fluid interface

See also

filterBy()

at line 273
public ModelCriteria where($clause, $value = null, $bindingType = null)

Adds a condition on a column based on a pseudo SQL clause Uses introspection to translate the column phpName into a fully qualified name <code> // simple clause $c->where('b.Title = ?', 'foo'); // named conditions $c->condition('cond1', 'b.Title = ?', 'foo'); $c->condition('cond2', 'b.ISBN = ?', 12345); $c->where(array('cond1', 'cond2'), Criteria::LOGICAL_OR); </code>

Parameters

$clause
$value
$bindingType

Return Value

ModelCriteria The current object, for fluid interface

See also

Criteria::add()

at line 307
public ModelCriteria orWhere($clause, $value = null, $bindingType = null)

Adds a condition on a column based on a pseudo SQL clause Uses introspection to translate the column phpName into a fully qualified name <code> // simple clause $c->orWhere('b.Title = ?', 'foo'); // named conditions $c->condition('cond1', 'b.Title = ?', 'foo'); $c->condition('cond2', 'b.ISBN = ?', 12345); $c->orWhere(array('cond1', 'cond2'), Criteria::LOGICAL_OR); </code>

Parameters

$clause
$value
$bindingType

Return Value

ModelCriteria The current object, for fluid interface

See also

Criteria::addOr()

at line 334
public ModelCriteria having($clause, $value = null, $bindingType = null)

Adds a having condition on a column based on a pseudo SQL clause Uses introspection to translate the column phpName into a fully qualified name <code> // simple clause $c->having('b.Title = ?', 'foo'); // named conditions $c->condition('cond1', 'b.Title = ?', 'foo'); $c->condition('cond2', 'b.ISBN = ?', 12345); $c->having(array('cond1', 'cond2'), Criteria::LOGICAL_OR); </code>

Parameters

$clause
$value
$bindingType

Return Value

ModelCriteria The current object, for fluid interface

See also

Criteria::addHaving()

at line 363
public ModelCriteria orderBy(string $columnName, string $order = Criteria::ASC)

Adds an ORDER BY clause to the query Usability layer on top of Criteria::addAscendingOrderByColumn() and Criteria::addDescendingOrderByColumn() Infers $column and $order from $columnName and some optional arguments Examples: $c->orderBy('Book.CreatedAt') => $c->addAscendingOrderByColumn(BookPeer::CREATED_AT) $c->orderBy('Book.CategoryId', 'desc') => $c->addDescendingOrderByColumn(BookPeer::CATEGORY_ID)

Parameters

string $columnName The column to order by
string $order The sorting order. Criteria::ASC by default, also accepts Criteria::DESC

Return Value

ModelCriteria The current object, for fluid interface

at line 393
public ModelCriteria groupBy(string $columnName)

Adds a GROUB BY clause to the query Usability layer on top of Criteria::addGroupByColumn() Infers $column $columnName Examples: $c->groupBy('Book.AuthorId') => $c->addGroupByColumn(BookPeer::AUTHOR_ID)

Parameters

string $columnName The column to group by

Return Value

ModelCriteria The current object, for fluid interface

at line 414
public ModelCriteria groupByClass(string $class)

Adds a GROUB BY clause for all columns of a model to the query Examples: $c->groupBy('Book'); => $c->addGroupByColumn(BookPeer::ID); => $c->addGroupByColumn(BookPeer::TITLE); => $c->addGroupByColumn(BookPeer::AUTHOR_ID); => $c->addGroupByColumn(BookPeer::PUBLISHER_ID);

Parameters

string $class The class name or alias

Return Value

ModelCriteria The current object, for fluid interface

at line 442
public ModelCriteria distinct()

Adds a DISTINCT clause to the query Alias for Criteria::setDistinct()

Return Value

ModelCriteria The current object, for fluid interface

at line 457
public ModelCriteria limit(int $limit)

Adds a LIMIT clause (or its subselect equivalent) to the query Alias for Criteria:::setLimit()

Parameters

int $limit Maximum number of results to return by the query

Return Value

ModelCriteria The current object, for fluid interface

at line 472
public ModelCriteria offset(int $offset)

Adds an OFFSET clause (or its subselect equivalent) to the query Alias for of Criteria::setOffset()

Parameters

int $offset Offset of the first result to return

Return Value

ModelCriteria The current object, for fluid interface

at line 501
public ModelCriteria select(mixed $columnArray)

Makes the ModelCriteria return a string, array, or PropelArrayCollection Examples: ArticleQuery::create()->select('Name')->find(); => PropelArrayCollection Object ('Foo', 'Bar')

ArticleQuery::create()->select('Name')->findOne();
=> string 'Foo'

ArticleQuery::create()->select(array('Id', 'Name'))->find();
=> PropelArrayCollection Object (
array('Id' => 1, 'Name' => 'Foo'),
array('Id' => 2, 'Name' => 'Bar')
)

ArticleQuery::create()->select(array('Id', 'Name'))->findOne();
=> array('Id' => 1, 'Name' => 'Foo')

Parameters

mixed $columnArray A list of column names (e.g. array('Title', 'Category.Name', 'c.Content')) or a single column name (e.g. 'Name')

Return Value

ModelCriteria The current object, for fluid interface

at line 525
public array|string getSelect()

Retrieves the columns defined by a previous call to select().

Return Value

array|string A list of column names (e.g. array('Title', 'Category.Name', 'c.Content')) or a single column name (e.g. 'Name')

See also

select()

at line 568
public Join getPreviousJoin()

This method returns the previousJoin for this ModelCriteria, by default this is null, but after useQuery this is set the to the join of that use

Return Value

Join the previousJoin for this ModelCriteria

at line 579
public setPreviousJoin(Join $previousJoin)

This method sets the previousJoin for this ModelCriteria, by default this is null, but after useQuery this is set the to the join of that use

Parameters

Join $previousJoin The previousJoin for this ModelCriteria

at line 591
public Join getJoin(string $name)

This method returns an already defined join clause from the query

Parameters

string $name The name of the join clause

Return Value

Join A join object

at line 617
public ModelCriteria join(string $relation, string $joinType = Criteria::INNER_JOIN)

Adds a JOIN clause to the query Infers the ON clause from a relation name Uses the Propel table maps, based on the schema, to guess the related columns Beware that the default JOIN operator is INNER JOIN, while Criteria defaults to WHERE Examples: <code> $c->join('Book.Author'); => $c->addJoin(BookPeer::AUTHOR_ID, AuthorPeer::ID, Criteria::INNER_JOIN); $c->join('Book.Author', Criteria::RIGHT_JOIN); => $c->addJoin(BookPeer::AUTHOR_ID, AuthorPeer::ID, Criteria::RIGHT_JOIN); $c->join('Book.Author a', Criteria::RIGHT_JOIN); => $c->addAlias('a', AuthorPeer::TABLE_NAME); => $c->addJoin(BookPeer::AUTHOR_ID, 'a.ID', Criteria::RIGHT_JOIN); </code>

Parameters

string $relation Relation to use for the join
string $joinType Accepted values are null, 'left join', 'right join', 'inner join'

Return Value

ModelCriteria The current object, for fluid interface

at line 682
public ModelCriteria addJoinCondition($name, $clause, $value = null, $operator = null, $bindingType = null)

Add another condition to an already added join

Parameters

$name
$clause
$value
$operator
$bindingType

Return Value

ModelCriteria The current object, for fluid interface

at line 714
public ModelCriteria setJoinCondition(string $name, mixed $condition)

Replace the condition of an already added join

Parameters

string $name The relation name or alias on which the join was created
mixed $condition A Criterion object, or a condition name

Return Value

ModelCriteria The current object, for fluid interface

at line 765
public ModelCriteria joinWith(string $relation, string $joinType = Criteria::INNER_JOIN)

Adds a JOIN clause to the query and hydrates the related objects Shortcut for $c->join()->with() <code> $c->joinWith('Book.Author'); => $c->join('Book.Author'); => $c->with('Author'); $c->joinWith('Book.Author a', Criteria::RIGHT_JOIN); => $c->join('Book.Author a', Criteria::RIGHT_JOIN); => $c->with('a'); </code>

Parameters

string $relation Relation to use for the join
string $joinType Accepted values are null, 'left join', 'right join', 'inner join'

Return Value

ModelCriteria The current object, for fluid interface

at line 791
public ModelCriteria with(string $relation)

Adds a relation to hydrate together with the main object The relation must be initialized via a join() prior to calling with() Examples: <code> $c->join('Book.Author'); $c->with('Author');

$c->join('Book.Author a', Criteria::RIGHT_JOIN);
$c->with('a');
</code>
WARNING: on a one-to-many relationship, the use of with() combined with limit()
will return a wrong number of results for the related objects

Parameters

string $relation Relation to use for the join

Return Value

ModelCriteria The current object, for fluid interface

at line 824
public array getWith()

Gets the array of ModelWith specifying which objects must be hydrated together with the main object.

Return Value

array

See also

with()

at line 837
public ModelCriteria setWith(array $with)

Sets the array of ModelWith specifying which objects must be hydrated together with the main object.

Parameters

array $with

Return Value

ModelCriteria The current object, for fluid interface

at line 844
public isWithOneToMany()

at line 861
public ModelCriteria withColumn(string $clause, string $name = null)

Adds a supplementary column to the select clause These columns can later be retrieved from the hydrated objects using getVirtualColumn()

Parameters

string $clause The SQL clause with object model column names e.g. 'UPPER(Author.FirstName)'
string $name Optional alias for the added column If no alias is provided, the clause is used as a column alias This alias is used for retrieving the column via BaseObject::getVirtualColumn($alias)

Return Value

ModelCriteria The current object, for fluid interface

at line 886
public ModelCriteria useQuery($relationName, $secondaryCriteriaClass = null)

Initializes a secondary ModelCriteria object, to be later merged with the current object

Parameters

$relationName
$secondaryCriteriaClass

Return Value

ModelCriteria The secondary criteria object

See also

ModelCriteria::endUse()

at line 912
public ModelCriteria endUse()

Finalizes a secondary criteria and merges it with its primary Criteria

Return Value

ModelCriteria The primary criteria object

See also

Criteria::mergeWith()

at line 968
public setPrimaryCriteria(ModelCriteria $criteria, Join $previousJoin)

Sets the primary Criteria for this secondary Criteria

Parameters

ModelCriteria $criteria The primary criteria
Join $previousJoin The previousJoin for this ModelCriteria

at line 979
public ModelCriteria getPrimaryCriteria()

Gets the primary criteria for this secondary Criteria

Return Value

ModelCriteria The primary criteria

at line 1019
public ModelCriteria addSelfSelectColumns()

Adds the select columns for a the current table

Return Value

ModelCriteria The current object, for fluid interface

at line 1033
public ModelCriteria addRelationSelectColumns(string $relation)

Adds the select columns for a relation

Parameters

string $relation The relation name or alias, as defined in join()

Return Value

ModelCriteria The current object, for fluid interface

at line 1050
static public array getClassAndAlias(string $class)

Returns the class and alias of a string representing a model or a relation e.g.

'Book b' => array('Book', 'b')
e.g. 'Book' => array('Book', null)

Parameters

string $class The classname to explode

Return Value

array list($className, $aliasName)

at line 1067
static public string getRelationName(string $relation)

Returns the name of a relation from a string.

The input looks like '$leftName.$relationName $relationAlias'

Parameters

string $relation Relation to use for the join

Return Value

string the relationName used in the join

at line 1092
public ModelCriteria keepQuery(boolean $isKeepQuery = true)

Triggers the automated cloning on termination.

By default, temrination methods don't clone the current object,
even though they modify it. If the query must be reused after termination,
you must call this method prior to temrination.

Parameters

boolean $isKeepQuery

Return Value

ModelCriteria The current object, for fluid interface

at line 1104
public boolean isKeepQuery()

Checks whether the automated cloning on termination is enabled.

Return Value

boolean true if cloning must be done before termination

at line 1132
public PropelObjectCollection|array|mixed find(PropelPDO $con = null)

Issue a SELECT query based on the current ModelCriteria and format the list of results with the current formatter By default, returns an array of model objects

Parameters

PropelPDO $con an optional connection object

Return Value

PropelObjectCollection|array|mixed the list of results, formatted by the current formatter

at line 1153
public mixed findOne(PropelPDO $con = null)

Issue a SELECT ...

LIMIT 1 query based on the current ModelCriteria
and format the result with the current formatter
By default, returns a model object

Parameters

PropelPDO $con an optional connection object

Return Value

mixed the result, formatted by the current formatter

at line 1175
public mixed findOneOrCreate(PropelPDO $con = null)

Issue a SELECT ...

LIMIT 1 query based on the current ModelCriteria
and format the result with the current formatter
By default, returns a model object

Parameters

PropelPDO $con an optional connection object

Return Value

mixed the result, formatted by the current formatter

at line 1202
public mixed findPk(mixed $key, PropelPDO $con = null)

Find object by primary key Behaves differently if the model has simple or composite primary key <code> // simple primary key $book = $c->findPk(12, $con); // composite primary key $bookOpinion = $c->findPk(array(34, 634), $con); </code>

Parameters

mixed $key Primary key to use for the query
PropelPDO $con an optional connection object

Return Value

mixed the result, formatted by the current formatter

at line 1241
public mixed findPks(array $keys, PropelPDO $con = null)

Find objects by primary key Behaves differently if the model has simple or composite primary key <code> // simple primary key $books = $c->findPks(array(12, 56, 832), $con); // composite primary key $bookOpinion = $c->findPks(array(array(34, 634), array(45, 518), array(34, 765)), $con); </code>

Parameters

array $keys Primary keys to use for the query
PropelPDO $con an optional connection object

Return Value

mixed the list of results, formatted by the current formatter

at line 1307
public mixed findBy(string $column, mixed $value, PropelPDO $con = null)

Apply a condition on a column and issues the SELECT query

Parameters

string $column A string representing the column phpName, e.g. 'AuthorId'
mixed $value A value for the condition
PropelPDO $con An optional connection object

Return Value

mixed the list of results, formatted by the current formatter

See also

filterBy()
find()

at line 1332
public mixed findByArray(mixed $conditions, PropelPDO $con = null)

Apply a list of conditions on columns and issues the SELECT query <code> $c->findByArray(array( 'Title' => 'War And Peace', 'Publisher' => $publisher ), $con); </code>

Parameters

mixed $conditions An array of conditions, using column phpNames as key
PropelPDO $con an optional connection object

Return Value

mixed the list of results, formatted by the current formatter

See also

filterByArray()
find()

at line 1351
public mixed findOneBy(mixed $column, mixed $value, PropelPDO $con = null)

Apply a condition on a column and issues the SELECT ...

LIMIT 1 query

Parameters

mixed $column A string representing thecolumn phpName, e.g. 'AuthorId'
mixed $value A value for the condition
PropelPDO $con an optional connection object

Return Value

mixed the result, formatted by the current formatter

See also

filterBy()
findOne()

at line 1376
public mixed findOneByArray(mixed $conditions, PropelPDO $con = null)

Apply a list of conditions on columns and issues the SELECT ...

LIMIT 1 query
<code>
$c->findOneByArray(array(
'Title' => 'War And Peace',
'Publisher' => $publisher
), $con);
</code>

Parameters

mixed $conditions An array of conditions, using column phpNames as key
PropelPDO $con an optional connection object

Return Value

mixed the list of results, formatted by the current formatter

See also

filterByArray()
findOne()

at line 1390
public integer count(PropelPDO $con = null)

Issue a SELECT COUNT(*) query based on the current ModelCriteria

Parameters

PropelPDO $con an optional connection object

Return Value

integer the number of results

at line 1472
public PropelModelPager paginate(int $page = 1, int $maxPerPage = 10, PropelPDO $con = null)

Issue a SELECT query based on the current ModelCriteria and uses a page and a maximum number of results per page to compute an offet and a limit.

Parameters

int $page number of the page to start the pager on. Page 1 means no offset
int $maxPerPage maximum number of results per page. Determines the limit
PropelPDO $con an optional connection object

Return Value

PropelModelPager a pager object, supporting iteration

at line 1519
public integer delete(PropelPDO $con = null)

Issue a DELETE query based on the current ModelCriteria An optional hook on basePreDelete() can prevent the actual deletion

Parameters

PropelPDO $con an optional connection object

Return Value

integer the number of deleted rows

at line 1555
public integer doDelete(PropelPDO $con)

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

Parameters

PropelPDO $con a connection object

Return Value

integer the number of deleted rows

at line 1570
public integer deleteAll(PropelPDO $con = null)

Issue a DELETE query based on the current ModelCriteria deleting all rows in the table An optional hook on basePreDelete() can prevent the actual deletion

Parameters

PropelPDO $con an optional connection object

Return Value

integer the number of deleted rows

at line 1599
public integer doDeleteAll(PropelPDO $con)

Issue a DELETE query based on the current ModelCriteria deleting all rows in the table This method is called by ModelCriteria::deleteAll() inside a transaction

Parameters

PropelPDO $con a connection object

Return Value

integer the number of deleted rows

at line 1649
public Integer update(array $values, PropelPDO $con = null, boolean $forceIndividualSaves = false)

Issue an UPDATE query based the current ModelCriteria and a list of changes.

An optional hook on basePreUpdate() can prevent the actual update.
Beware that behaviors based on hooks in the object's save() method
will only be triggered if you force individual saves, i.e. if you pass true as second argument.

Parameters

array $values Associative array of keys and values to replace
PropelPDO $con an optional connection object
boolean $forceIndividualSaves If false (default), the resulting call is a BasePeer::doUpdate(), ortherwise it is a series of save() calls on all the found objects

Return Value

Integer Number of updated rows

at line 1692
public Integer doUpdate(array $values, PropelPDO $con, boolean $forceIndividualSaves = false)

Issue an UPDATE query based the current ModelCriteria and a list of changes.

This method is called by ModelCriteria::update() inside a transaction.

Parameters

array $values Associative array of keys and values to replace
PropelPDO $con a connection object
boolean $forceIndividualSaves If false (default), the resulting call is a BasePeer::doUpdate(), ortherwise it is a series of save() calls on all the found objects

Return Value

Integer Number of updated rows

at line 2010
public string getAliasedColName(string $colName)

Changes the table part of a a fully qualified column name if a true model alias exists e.g.

=> 'book.TITLE' => 'b.TITLE'
This is for use as first argument of Criteria::add()

Parameters

string $colName the fully qualified column name, e.g 'book.TITLE' or BookPeer::TITLE

Return Value

string the fully qualified column name, using table alias if applicatble

at line 2029
public ModelCriteria addUsingAlias($p1, $value = null, $operator = null)

Overrides Criteria::add() to force the use of a true table alias if it exists

Parameters

$p1
$value
$operator

Return Value

ModelCriteria A modified Criteria object.

See also

Criteria::add()

at line 2041
public array getParams()

Get all the parameters to bind to this criteria Does part of the job of BasePeer::createSelectSql() for the cache

Return Value

array list of parameters, each parameter being an array like array('table' => $realtable, 'column' => $column, 'value' => $value)

at line 2082
public __call($name, $arguments)

Handle the magic Supports findByXXX(), findOneByXXX(), filterByXXX(), orderByXXX(), and groupByXXX() methods, where XXX is a column phpName.

Supports XXXJoin(), where XXX is a join direction (in 'left', 'right', 'inner')

Parameters

$name
$arguments