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|null |
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|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($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 |
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|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($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. |
||
array |
explain(PropelPDO $con = null)
Make explain plan of the query |
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.
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
at line 975
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.
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>
in Criteria at line 333
public array
getAsColumns()
Get the column aliases.
in Criteria at line 344
public string|null
getColumnForAs($as)
Returns the column name associated with an alias (AS-column).
in Criteria at line 362
public Criteria
addAlias(string $alias, string $table)
Allows one to specify an alias for a table that can be used in various parts of the SQL.
in Criteria at line 376
public Criteria
removeAlias(string $alias)
Remove an alias for a table (useful when merging Criterias).
in Criteria at line 388
public array
getAliases()
Returns the aliases for this Criteria
in Criteria at line 399
public string|null
getTableForAlias(string $alias)
Returns the table name associated with an alias.
in Criteria at line 416
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.
in Criteria at line 434
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>
in Criteria at line 445
public boolean
containsKey(string $column)
Does this Criteria object contain the specified key?
in Criteria at line 458
public boolean
keyContainsValue(string $column)
Does this Criteria object contain the specified key and does it have a value set for the key
in Criteria at line 473
public boolean
hasWhereClause()
Whether this Criteria has any where columns.
This counts conditions added with the add() method.
in Criteria at line 485
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.
in Criteria at line 496
public boolean
isUseTransaction()
Whether the sql command specified by this criteria must be wrapped in a transaction.
in Criteria at line 510
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.
in Criteria at line 520
public Criterion
getLastCriterion()
Method to return the latest Criterion in a table.
in Criteria at line 541
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.
in Criteria at line 552
public string
getColumnName(string $name)
Method to return a String table name.
in Criteria at line 573
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>
in Criteria at line 590
public string
getComparison(string $key)
Method to return a comparison String.
in Criteria at line 604
public string
getDbName()
Get the Database(Map) name.
in Criteria at line 616
public void
setDbName(string $dbName = null)
Set the DatabaseMap name.
If <code>null</code> is supplied, uses value
provided by <code>Propel::getDefaultDB()</code>.
in Criteria at line 630
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.
in Criteria at line 644
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.
in Criteria at line 655
public string
getTableName(string $name)
Method to return a String table name.
in Criteria at line 670
public mixed
getValue(string $name)
Method to return the value that was added to Criteria.
in Criteria at line 685
public mixed
get(string $key)
An alias to getValue() -- exposing a Hashtable-like interface.
in Criteria at line 704
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.
in Criteria at line 719
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.
in Criteria at line 755
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'.
in Criteria at line 790
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'.
in Criteria at line 808
public Criteria
combine(array $criterions = array(), string $operator = self::LOGICAL_AND, string $name = null)
Combine several named criterions with a logical operator
in Criteria at line 849
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>
in Criteria at line 905
public Criteria
addMultipleJoin(array $conditions, string $joinType = null)
Add a join with multiple conditions
at line 754
public ModelCriteria
addJoinObject(Join $join, $name = null)
Add a join object to the Criteria
in Criteria at line 972
public array
getJoins()
Get the array of Joins.
at line 1018
public ModelCriteria
addSelectQuery(Criteria $subQueryCriteria, string $alias = null, boolean $addAliasAndSelectColumns = true)
Adds a Criteria as subQuery in the From Clause.
in Criteria at line 1000
public Boolean
hasSelectQueries()
Checks whether this Criteria has a subquery.
in Criteria at line 1010
public array
getSelectQueries()
Get the associative array of Criteria for the subQueries per alias.
in Criteria at line 1021
public Criteria
getSelectQuery(string $alias)
Get the Criteria for a specific subQuery.
in Criteria at line 1032
public boolean
hasSelectQuery(string $alias)
checks if the Criteria for a specific subQuery is set.
in Criteria at line 1037
public
forgeSelectQueryAlias()
in Criteria at line 1051
public Criteria
setAll()
Adds "ALL" modifier to the SQL statement.
in Criteria at line 1063
public Criteria
setDistinct()
Adds "DISTINCT" modifier to the SQL statement.
in Criteria at line 1079
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.
in Criteria at line 1097
public Criteria
removeSelectModifier(string $modifier)
Removes a modifier to the SQL statement.
Checks for existence before removal
in Criteria at line 1111
public bool
hasSelectModifier(string $modifier)
Checks the existence of a SQL select modifier
in Criteria at line 1122
public Criteria
setIgnoreCase(boolean $b)
Sets ignore case.
in Criteria at line 1134
public boolean
isIgnoreCase()
Is ignore case on or off?
in Criteria at line 1151
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).
in Criteria at line 1163
public boolean
isSingleRecord()
Is single record?
in Criteria at line 1174
public Criteria
setLimit(limit $limit)
Set limit.
in Criteria at line 1187
public int
getLimit()
Get limit.
in Criteria at line 1199
public Criteria
setOffset(int $offset)
Set offset.
in Criteria at line 1211
public An
getOffset()
Get offset.
in Criteria at line 1222
public Criteria
addSelectColumn(string $name)
Add select column.
in Criteria at line 1235
public Criteria
setComment(string $comment = null)
Set the query comment, that appears after the first verb in the SQL query
in Criteria at line 1247
public string
getComment()
Get the query comment, that appears after the first verb in the SQL query
in Criteria at line 1261
public boolean
hasSelectClause()
Whether this Criteria has any select columns.
This will include columns added with addAsColumn() method.
in Criteria at line 1271
public array
getSelectColumns()
Get select columns.
in Criteria at line 1281
public Criteria
clearSelectColumns()
Clears current select columns.
in Criteria at line 1293
public An
getSelectModifiers()
Get select modifiers.
in Criteria at line 1304
public A
addGroupByColumn(string $groupBy)
Add group by column name.
in Criteria at line 1317
public A
addAscendingOrderByColumn(string $name)
Add order by column name, explicitly specifying ascending.
in Criteria at line 1330
public Criteria
addDescendingOrderByColumn(string $name)
Add order by column name, explicitly specifying descending.
in Criteria at line 1342
public array
getOrderByColumns()
Get order by columns.
in Criteria at line 1352
public Criteria
clearOrderByColumns()
Clear the order-by columns.
in Criteria at line 1364
public Criteria
clearGroupByColumns()
Clear the group-by columns.
in Criteria at line 1376
public array
getGroupByColumns()
Get group by columns.
in Criteria at line 1386
public Criterion
getHaving()
Get Having Criterion.
in Criteria at line 1397
public mixed|null
remove(string $key)
Remove an object from the criteria.
in Criteria at line 1417
public string
toString()
Build a string representation of the Criteria.
in Criteria at line 1445
public int
size()
Returns the size (count) of this criteria.
in Criteria at line 1455
public boolean
equals($crit)
This method checks another Criteria to see if they contain the same attributes and hashtable entries.
at line 957
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
in Criteria at line 1615
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>
in Criteria at line 1673
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)
in Criteria at line 1704
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)
in Criteria at line 1742
public Criteria
addUsingOperator(string|Criterion $p1, mixed $value = null, string $operator = null, boolean $preferColumnCondition = true)
Overrides Criteria::add() to use the default combine operator
in Criteria at line 1755
public
_or()
in Criteria at line 1762
public
_and()
in Criteria at line 1780
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.
in Criteria at line 1797
public PropelConditionalProxy|Criteria
_elseif(bool $cond)
Returns a PropelConditionalProxy instance.
Allows for conditional statements in a fluid interface.
in Criteria at line 1814
public PropelConditionalProxy|Criteria
_else()
Returns a PropelConditionalProxy instance.
Allows for conditional statements in a fluid interface.
in Criteria at line 1831
public Criteria
_endif()
Returns the current object Allows for conditional statements in a fluid interface.
at line 2209
public
__clone()
Ensures deep cloning of attached objects
at line 78
public string
getModelName()
Returns the name of the class for this model criteria
at line 91
public ModelCriteria
setModelAlias(string $modelAlias, boolean $useAliasInSQL = false)
Sets the alias for the model in this query
at line 107
public string
getModelAlias()
Returns the alias of the main class for this model criteria
at line 117
public string
getModelAliasOrName()
Return the string to use in a clause as a model prefix for the main model
at line 127
public string
getModelPeerName()
Returns the name of the Peer class for this model criteria
at line 137
public TableMap
getTableMap()
Returns the TabkleMap object for this Criteria
at line 155
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>
at line 174
public PropelFormatter
getFormatter()
Gets the formatter to use for the find() output Defaults to an instance of ModelCriteria::$defaultFormatterClass, i.e.
PropelObjectsFormatter
at line 202
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>
at line 225
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>
at line 247
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>
at line 276
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>
at line 310
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>
at line 337
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>
at line 368
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)
at line 398
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)
at line 421
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);
at line 449
public ModelCriteria
distinct()
Adds a DISTINCT clause to the query Alias for Criteria::setDistinct()
at line 464
public ModelCriteria
limit(int $limit)
Adds a LIMIT clause (or its subselect equivalent) to the query Alias for Criteria:::setLimit()
at line 479
public ModelCriteria
offset(int $offset)
Adds an OFFSET clause (or its subselect equivalent) to the query Alias for of Criteria::setOffset()
at line 510
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')
at line 534
public array|string
getSelect()
Retrieves the columns defined by a previous call to select().
at line 579
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
at line 590
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
at line 602
public Join
getJoin(string $name)
This method returns an already defined join clause from the query
at line 630
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>
at line 697
public ModelCriteria
addJoinCondition($name, $clause, $value = null, $operator = null, $bindingType = null)
Add another condition to an already added join
at line 731
public ModelCriteria
setJoinCondition(string $name, mixed $condition)
Replace the condition of an already added join
at line 784
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>
at line 812
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
at line 845
public array
getWith()
Gets the array of ModelWith specifying which objects must be hydrated together with the main object.
at line 858
public ModelCriteria
setWith(array $with)
Sets the array of ModelWith specifying which objects must be hydrated together with the main object.
at line 865
public
isWithOneToMany()
at line 882
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()
at line 909
public ModelCriteria
useQuery($relationName, $secondaryCriteriaClass = null)
Initializes a secondary ModelCriteria object, to be later merged with the current object
at line 935
public ModelCriteria
endUse()
Finalizes a secondary criteria and merges it with its primary Criteria
at line 991
public
setPrimaryCriteria(ModelCriteria $criteria, Join $previousJoin)
Sets the primary Criteria for this secondary Criteria
at line 1002
public ModelCriteria
getPrimaryCriteria()
Gets the primary criteria for this secondary Criteria
at line 1043
public ModelCriteria
addSelfSelectColumns()
Adds the select columns for a the current table
at line 1057
public ModelCriteria
addRelationSelectColumns(string $relation)
Adds the select columns for a relation
at line 1074
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)
at line 1092
static public string
getRelationName(string $relation)
Returns the name of a relation from a string.
The input looks like '$leftName.$relationName $relationAlias'
at line 1117
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.
at line 1129
public boolean
isKeepQuery()
Checks whether the automated cloning on termination is enabled.
at line 1157
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
at line 1178
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
at line 1202
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
at line 1233
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>
at line 1274
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>
at line 1342
public mixed
findBy(string $column, mixed $value, PropelPDO $con = null)
Apply a condition on a column and issues the SELECT query
at line 1367
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>
at line 1386
public mixed
findOneBy(mixed $column, mixed $value, PropelPDO $con = null)
Apply a condition on a column and issues the SELECT ...
LIMIT 1 query
at line 1411
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>
at line 1425
public integer
count(PropelPDO $con = null)
Issue a SELECT COUNT(*) query based on the current ModelCriteria
at line 1508
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.
at line 1557
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
at line 1593
public integer
doDelete(PropelPDO $con)
Issue a DELETE query based on the current ModelCriteria This method is called by ModelCriteria::delete() inside a transaction
at line 1610
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
at line 1638
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
at line 1690
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.
at line 1733
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.
at line 2075
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()
at line 2094
public ModelCriteria
addUsingAlias($p1, $value = null, $operator = null)
Overrides Criteria::add() to force the use of a true table alias if it exists
at line 2106
public array
getParams()
Get all the parameters to bind to this criteria Does part of the job of BasePeer::createSelectSql() for the cache
at line 2147
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')
at line 2227
public array
explain(PropelPDO $con = null)
Make explain plan of the query