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

Properties

$replacedColumns
ModelJoin[] $joins ModelJoin[]$joins

Methods

__construct(string $dbName, 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
Criterion[] 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|null getColumnForAs(string $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|null 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(bool $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(string $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
Criteria 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(string $critOrColumn, mixed $value = null, string $comparison = null)

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

from Criteria
Criteria 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
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, string $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
Criteria[] getSelectQueries()

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

from Criteria
ModelCriteria getSelectQuery($alias)

Get the Criteria for a specific subQuery

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 true 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(int $limit)

Set limit.

from Criteria
int getLimit()

Get limit.

from Criteria
Criteria setOffset(int $offset)

Set offset.

from Criteria
int 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
array getSelectModifiers()

Get select modifiers.

from Criteria
Criteria addGroupByColumn(string $groupBy)

Add group by column name.

from Criteria
Criteria 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|null 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(Criteria|null $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

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

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

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

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 TableMap 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: $c->setFormatter(ModelCriteria::FORMAT_ARRAY);

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 $c->condition('cond1', 'b.Title = ?', 'foo');

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) $c->filterBy('Title', 'foo');

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) $c->filterByArray(array( 'Title' => 'War And Peace', 'Publisher' => $publisher ));

ModelCriteria where(mixed $clause, mixed $value = null, string $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 // 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);

ModelCriteria orWhere(string $clause, mixed $value = null, string $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 // 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);

ModelCriteria having(mixed $clause, mixed $value = null, string $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 // 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);

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::CREATEDAT) $c->orderBy('Book.CategoryId', 'desc') => $c->addDescendingOrderByColumn(BookPeer::CATEGORYID)

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::AUTHORID); => $c->addGroupByColumn(BookPeer::PUBLISHERID);

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: $c->join('Book.Author'); => $c->addJoin(BookPeer::AUTHORID, AuthorPeer::ID, Criteria::INNERJOIN); $c->join('Book.Author', Criteria::RIGHTJOIN); => $c->addJoin(BookPeer::AUTHORID, AuthorPeer::ID, Criteria::RIGHTJOIN); $c->join('Book.Author a', Criteria::RIGHTJOIN); => $c->addAlias('a', AuthorPeer::TABLENAME); => $c->addJoin(BookPeer::AUTHORID, 'a.ID', Criteria::RIGHT_JOIN);

ModelCriteria addJoinCondition(string $name, string $clause, mixed $value = null, string $operator = null, string $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() $c->joinWith('Book.Author'); => $c->join('Book.Author'); => $c->with('Author'); $c->joinWith('Book.Author a', Criteria::RIGHTJOIN); => $c->join('Book.Author a', Criteria::RIGHTJOIN); => $c->with('a');

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: $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(string $relationName, string $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 // simple primary key $book = $c->findPk(12, $con); // composite primary key $bookOpinion = $c->findPk(array(34, 634), $con);

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

Find objects by primary key Behaves differently if the model has simple or composite primary key // 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);

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 $c->findByArray(array( 'Title' => 'War And Peace', 'Publisher' => $publisher ), $con);

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(string $column, mixed $value = null, string $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.

array explain(PropelPDO $con = null)

Make explain plan of the query

boolean exists(PropelPDO $con = null)

ModelCriteria leftJoin($relation)

Adds a LEFT JOIN clause to the query

ModelCriteria rightJoin($relation)

Adds a RIGHT JOIN clause to the query

ModelCriteria innerJoin($relation)

Adds a INNER JOIN clause to the query

Details

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

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

Parameters

string $dbName The database 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 282
public getIterator()

Implementing SPL IteratorAggregate interface.

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

in Criteria at line 292
public Criterion[] getMap()

Get the criteria map, i.e.

the array of Criterions

Return Value

Criterion[]

at line 1020
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 346
public Criteria addAsColumn(string $name, string $clause)

Add an AS clause to the select columns.

Usage:

Criteria myCrit = new Criteria(); myCrit->addAsColumn("alias", "ALIAS(".MyPeer::ID.")");

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 359
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 371
public string|null getColumnForAs(string $as)

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

Parameters

string $as

Return Value

string|null $string The name if found, null otherwise.

in Criteria at line 389
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 403
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 415
public array getAliases()

Returns the aliases for this Criteria

Return Value

array

in Criteria at line 427
public string|null getTableForAlias(string $alias)

Returns the table name associated with an alias.

Parameters

string $alias

Return Value

string|null $string The name if given, null otherwise.

in Criteria at line 445
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 463
public array keys()

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

the list of columns bearing a condition printr($c->keys()); => array('book.price', 'book.title', 'author.firstname')

Return Value

array

in Criteria at line 475
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 489
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 504
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 519
public void setUseTransaction(bool $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

bool $v

Return Value

void

in Criteria at line 530
public boolean isUseTransaction()

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

Return Value

boolean

in Criteria at line 545
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 555
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 577
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 589
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 610
public array getTablesColumns()

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

printr($c->getTablesColumns()); => array( 'book' => array('book.price', 'book.title'), 'author' => array('author.firstname') )

Return Value

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

in Criteria at line 628
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 642
public string getDbName()

Get the Database(Map) name.

Return Value

string A String with the Database(Map) name.

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

Set the DatabaseMap name.

If null is supplied, uses value provided by Propel::getDefaultDB().

Parameters

string $dbName The Database (Map) name.

Return Value

void

in Criteria at line 669
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 683
public setPrimaryTableName(string $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

string $tableName

in Criteria at line 695
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 711
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 727
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 747
public Criteria 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

Criteria A modified Criteria object.

in Criteria at line 762
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 798
public Criteria add(string $critOrColumn, mixed $value = null, string $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:

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

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 $critOrColumn The column to run the comparison on, or a Criterion object.
mixed $value
string $comparison A String.

Return Value

Criteria A modified Criteria object.

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

$crit = new Criteria(); $crit->addCond('cond1', $column1, $value1, Criteria::GREATERTHAN); $crit->addCond('cond2', $column2, $value2, Criteria::EQUAL); $crit->combine(array('cond1', 'cond2'), Criteria::LOGICALOR);

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

Criteria A modified Criteria object.

in Criteria at line 851
public Criteria 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::LOGICALAND, or Criteria::LOGICALOR
string $name optional name to combine the criterion later

Return Value

Criteria

Exceptions

PropelException

in Criteria at line 892
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: $c->addJoin(ProjectPeer::ID, FooPeer::PROJECTID, Criteria::LEFTJOIN); // LEFT JOIN FOO ON (PROJECT.ID = FOO.PROJECT_ID)

Parameters

mixed $left A String with the left side of the join, or an array (see addMultipleJoin).
mixed $right A String with the right side of the join, or an array (see addMultipleJoin).
mixed $joinType A String with the join operator among Criteria::INNERJOIN, Criteria::LEFTJOIN, and Criteria::RIGHT_JOIN

Return Value

Criteria A modified Criteria object.

in Criteria at line 950
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 789
public ModelCriteria addJoinObject(Join $join, string $name = null)

Add a join object to the Criteria

Parameters

Join $join A join object
string $name

Return Value

ModelCriteria The current object, for fluid interface

See also

Criteria::addJoinObject()

in Criteria at line 1030
public array getJoins()

Get the array of Joins.

Return Value

array Join[]

at line 1074
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 1058
public boolean hasSelectQueries()

Checks whether this Criteria has a subquery.

Return Value

boolean

in Criteria at line 1068
public Criteria[] getSelectQueries()

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

Return Value

Criteria[]

at line 32
ModelCriteria getSelectQuery($alias)

Get the Criteria for a specific subQuery

Parameters

$alias

Return Value

ModelCriteria

in Criteria at line 1092
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 1097
public forgeSelectQueryAlias()

in Criteria at line 1113
public Criteria setAll()

Adds "ALL" modifier to the SQL statement.

Return Value

Criteria Modified Criteria object (for fluent API)

in Criteria at line 1126
public Criteria setDistinct()

Adds "DISTINCT" modifier to the SQL statement.

Return Value

Criteria Modified Criteria object (for fluent API)

in Criteria at line 1142
public Criteria addSelectModifier(string $modifier)

Adds a modifier to the SQL statement.

e.g. self::ALL, self::DISTINCT, 'SQLCALCFOUNDROWS', 'HIGHPRIORITY', etc.

Parameters

string $modifier The modifier to add

Return Value

Criteria Modified Criteria object (for fluent API)

in Criteria at line 1160
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 1174
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 1186
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 1198
public boolean isIgnoreCase()

Is ignore case on or off?

Return Value

boolean True if case is ignored.

in Criteria at line 1216
public Criteria setSingleRecord(boolean $b)

Set single record? Set this to true 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 1228
public boolean isSingleRecord()

Is single record?

Return Value

boolean True if a single record is being returned.

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

in Criteria at line 1253
public int getLimit()

Get limit.

Return Value

int An int with the value for limit.

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

in Criteria at line 1278
public int getOffset()

Get offset.

Return Value

int An int with the value for offset.

in Criteria at line 1290
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 1304
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 1316
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 1330
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 1340
public array getSelectColumns()

Get select columns.

Return Value

array An array with the name of the select columns.

in Criteria at line 1350
public Criteria clearSelectColumns()

Clears current select columns.

Return Value

Criteria Modified Criteria object (for fluent API)

in Criteria at line 1362
public array getSelectModifiers()

Get select modifiers.

Return Value

array An array with the select modifiers.

in Criteria at line 1374
public Criteria addGroupByColumn(string $groupBy)

Add group by column name.

Parameters

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

Return Value

Criteria Modified Criteria object (for fluent API)

in Criteria at line 1388
public Criteria addAscendingOrderByColumn(string $name)

Add order by column name, explicitly specifying ascending.

Parameters

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

Return Value

Criteria Modified Criteria object (for fluent API)

in Criteria at line 1402
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 1414
public array getOrderByColumns()

Get order by columns.

Return Value

array An array with the name of the order columns.

in Criteria at line 1424
public Criteria clearOrderByColumns()

Clear the order-by columns.

Return Value

Criteria Modified Criteria object (for fluent API)

in Criteria at line 1436
public Criteria clearGroupByColumns()

Clear the group-by columns.

Return Value

Criteria

in Criteria at line 1448
public array getGroupByColumns()

Get group by columns.

Return Value

array

in Criteria at line 1458
public Criterion getHaving()

Get Having Criterion.

Return Value

Criterion A Criterion object that is the having clause.

in Criteria at line 1470
public mixed|null remove(string $key)

Remove an object from the criteria.

Parameters

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

Return Value

mixed|null The removed value, null if not set.

in Criteria at line 1490
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 1518
public int size()

Returns the size (count) of this criteria.

Return Value

int

in Criteria at line 1531
public boolean equals(Criteria|null $crit)

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

Parameters

Criteria|null $crit

Return Value

boolean

at line 1002
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::LOGICALAND, also accepts Criteria::LOGICALOR

Return Value

ModelCriteria The primary criteria object

See also

Criteria::mergeWith()

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

$crit = new Criteria(); $c = $crit->getNewCriterion(BasePeer::ID, 5, Criteria::LESS_THAN); $crit->addHaving($c);

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 Criteria class constant, or a PDO::PARAM_ class constant

Return Value

Criteria Modified Criteria object (for fluent API)

in Criteria at line 1757
public Criteria addAnd(mixed $p1, mixed $value = null, mixed $comparison = null, bool $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

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 Criteria class constant, or a PDO::PARAM_ class constant
bool $preferColumnCondition

Return Value

Criteria A modified Criteria object.

in Criteria at line 1793
public Criteria addOr(mixed $p1, mixed $value = null, mixed $comparison = null, bool $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

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 Criteria class constant, or a PDO::PARAM_ class constant
bool $preferColumnCondition

Return Value

Criteria A modified Criteria object.

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

at line 32
ModelCriteria _or()

Return Value

ModelCriteria

in Criteria at line 1858
public Criteria _and()

Return Value

Criteria

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

Exceptions

PropelException

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

Returns a PropelConditionalProxy instance.

Allows for conditional statements in a fluid interface.

in Criteria at line 1927
public Criteria _endif()

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

Return Value

Criteria

Exceptions

PropelException

at line 2296
public __clone()

Ensures deep cloning of attached objects

at line 90
public string getModelName()

Returns the name of the class for this model criteria

Return Value

string

at line 103
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 119
public string getModelAlias()

Returns the alias of the main class for this model criteria

Return Value

string The model alias

at line 129
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 139
public string getModelPeerName()

Returns the name of the Peer class for this model criteria

Return Value

string

at line 149
public TableMap getTableMap()

Returns the TableMap object for this Criteria

Return Value

TableMap

at line 168
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: $c->setFormatter(ModelCriteria::FORMAT_ARRAY);

Parameters

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

Return Value

ModelCriteria The current object, for fluid interface

Exceptions

PropelException

at line 187
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 215
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 $c->condition('cond1', 'b.Title = ?', 'foo');

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 238
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) $c->filterBy('Title', 'foo');

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 260
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) $c->filterByArray(array( 'Title' => 'War And Peace', 'Publisher' => $publisher ));

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 290
public ModelCriteria where(mixed $clause, mixed $value = null, string $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 // 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);

Parameters

mixed $clause A string representing the pseudo SQL clause, e.g. 'Book.AuthorId = ?' Or an array of condition names
mixed $value A value for the condition
string $bindingType

Return Value

ModelCriteria The current object, for fluid interface

See also

Criteria::add()

at line 325
public ModelCriteria orWhere(string $clause, mixed $value = null, string $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 // 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);

Parameters

string $clause The pseudo SQL clause, e.g. 'AuthorId = ?'
mixed $value A value for the condition
string $bindingType

Return Value

ModelCriteria The current object, for fluid interface

See also

Criteria::addOr()

at line 353
public ModelCriteria having(mixed $clause, mixed $value = null, string $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 // 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);

Parameters

mixed $clause A string representing the pseudo SQL clause, e.g. 'Book.AuthorId = ?' Or an array of condition names
mixed $value A value for the condition
string $bindingType

Return Value

ModelCriteria The current object, for fluid interface

See also

Criteria::addHaving()

at line 384
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::CREATEDAT) $c->orderBy('Book.CategoryId', 'desc') => $c->addDescendingOrderByColumn(BookPeer::CATEGORYID)

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

Exceptions

PropelException

at line 414
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 437
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::AUTHORID); => $c->addGroupByColumn(BookPeer::PUBLISHERID);

Parameters

string $class The class name or alias

Return Value

ModelCriteria The current object, for fluid interface

Exceptions

PropelException

at line 465
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 480
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 495
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 526
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

Exceptions

PropelException

at line 551
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 608
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 619
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 631
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 659
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: $c->join('Book.Author'); => $c->addJoin(BookPeer::AUTHORID, AuthorPeer::ID, Criteria::INNERJOIN); $c->join('Book.Author', Criteria::RIGHTJOIN); => $c->addJoin(BookPeer::AUTHORID, AuthorPeer::ID, Criteria::RIGHTJOIN); $c->join('Book.Author a', Criteria::RIGHTJOIN); => $c->addAlias('a', AuthorPeer::TABLENAME); => $c->addJoin(BookPeer::AUTHORID, 'a.ID', Criteria::RIGHT_JOIN);

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

Exceptions

PropelException

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

Add another condition to an already added join

Parameters

string $name The relation name or alias on which the join was created
string $clause SQL clause, may contain column and table phpNames
mixed $value An optional value to bind to the clause
string $operator The operator to use to add the condition. Defaults to 'AND'
string $bindingType

Return Value

ModelCriteria The current object, for fluid interface

Exceptions

PropelException

at line 763
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

Exceptions

PropelException

at line 827
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() $c->joinWith('Book.Author'); => $c->join('Book.Author'); => $c->with('Author'); $c->joinWith('Book.Author a', Criteria::RIGHTJOIN); => $c->join('Book.Author a', Criteria::RIGHTJOIN); => $c->with('a');

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 855
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: $c->join('Book.Author'); $c->with('Author');

$c->join('Book.Author a', Criteria::RIGHT_JOIN); $c->with('a'); 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

Exceptions

PropelException

at line 888
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 901
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 908
public isWithOneToMany()

at line 925
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 953
public ModelCriteria useQuery(string $relationName, string $secondaryCriteriaClass = null)

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

Parameters

string $relationName Relation name or alias
string $secondaryCriteriaClass Classname for the ModelCriteria to be used

Return Value

ModelCriteria The secondary criteria object

Exceptions

PropelException

See also

ModelCriteria::endUse()

at line 979
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 1047
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 1058
public ModelCriteria getPrimaryCriteria()

Gets the primary criteria for this secondary Criteria

Return Value

ModelCriteria The primary criteria

at line 1100
public ModelCriteria addSelfSelectColumns()

Adds the select columns for a the current table

Return Value

ModelCriteria The current object, for fluid interface

at line 1114
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 1131
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 1150
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 1175
public ModelCriteria keepQuery(boolean $isKeepQuery = true)

Triggers the automated cloning on termination.

By default, termination 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 termination.

Parameters

boolean $isKeepQuery

Return Value

ModelCriteria The current object, for fluid interface

at line 1187
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 1220
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 1241
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 1265
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

Exceptions

PropelException

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

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

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 1339
public mixed findPks(array $keys, PropelPDO $con = null)

Find objects by primary key Behaves differently if the model has simple or composite primary key // 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);

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

Exceptions

PropelException

at line 1407
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 1432
public mixed findByArray(mixed $conditions, PropelPDO $con = null)

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

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 1451
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 1476
public mixed findOneByArray(mixed $conditions, PropelPDO $con = null)

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

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

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 1490
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 1579
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 1639
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

Exceptions

PropelException

at line 1675
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 1692
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

Exceptions

Exception|PropelException

at line 1720
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 1772
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(), otherwise it is a series of save() calls on all the found objects

Return Value

Integer Number of updated rows

Exceptions

PropelException

at line 1816
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(), otherwise it is a series of save() calls on all the found objects

Return Value

Integer Number of updated rows

at line 2163
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 applicable

at line 2183
public ModelCriteria addUsingAlias(string $column, mixed $value = null, string $operator = null)

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

Parameters

string $column The colName of column to run the condition on (e.g. BookPeer::ID)
mixed $value
string $operator A String, like Criteria::EQUAL.

Return Value

ModelCriteria A modified Criteria object.

See also

Criteria::add()

at line 2195
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 2236
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

at line 2315
public array explain(PropelPDO $con = null)

Make explain plan of the query

Parameters

PropelPDO $con propel connection

Return Value

array array of the explain plan

Exceptions

PropelException on error

at line 2344
public boolean exists(PropelPDO $con = null)

Parameters

PropelPDO $con = null

Return Value

boolean

at line 32
ModelCriteria leftJoin($relation)

Adds a LEFT JOIN clause to the query

Parameters

$relation

Return Value

ModelCriteria

at line 32
ModelCriteria rightJoin($relation)

Adds a RIGHT JOIN clause to the query

Parameters

$relation

Return Value

ModelCriteria

at line 32
ModelCriteria innerJoin($relation)

Adds a INNER JOIN clause to the query

Parameters

$relation

Return Value

ModelCriteria