class ModelCriteria extends BaseModelCriteria
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 |
FORMAT_STATEMENT |
|
FORMAT_ARRAY |
|
FORMAT_OBJECT |
|
FORMAT_ON_DEMAND |
|
Methods
__construct(string $dbName = null, string $modelName = null, string $modelAlias = null)
Creates a new instance with the default capacity which corresponds to the specified database. |
from BaseModelCriteria | |
array |
getWith()
Gets the array of ModelWith specifying which objects must be hydrated together with the main object. |
from BaseModelCriteria |
ModelCriteria |
setWith(array $with)
Sets the array of ModelWith specifying which objects must be hydrated together with the main object. |
from BaseModelCriteria |
ModelCriteria |
setFormatter(string|AbstractFormatter $formatter)
Sets the formatter to use for the find() output Formatters must extend AbstractFormatter Use the ModelCriteria constants for class names: <code> $c->setFormatter(ModelCriteria::FORMAT_ARRAY); </code> |
from BaseModelCriteria |
AbstractFormatter |
getFormatter()
Gets the formatter to use for the find() output Defaults to an instance of ModelCriteria::$defaultFormatterClass, i.e. |
from BaseModelCriteria |
string |
getModelName()
Returns the name of the class for this model criteria |
from BaseModelCriteria |
ModelCriteria |
setModelName(string $modelName)
Sets the model name. |
from BaseModelCriteria |
getFullyQualifiedModelName() | from BaseModelCriteria | |
ModelCriteria |
setModelAlias(string $modelAlias, boolean $useAliasInSQL = false)
Sets the alias for the model in this query |
from BaseModelCriteria |
string |
getModelAlias()
Returns the alias of the main class for this model criteria |
from BaseModelCriteria |
string |
getModelAliasOrName()
Return the string to use in a clause as a model prefix for the main model |
from BaseModelCriteria |
string |
getModelShortName()
Return The short model name (the short ClassName for class with namespace) |
from BaseModelCriteria |
TableMap |
getTableMap()
Returns the TableMap object for this Criteria |
from BaseModelCriteria |
Traversable |
getIterator()
Execute the query with a find(), and return a Traversable object. |
from BaseModelCriteria |
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 |
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(BookTableMap::CREATED_AT) $c->orderBy('Book.CategoryId', 'desc') => $c->addDescendingOrderByColumn(BookTableMap::CATEGORY_ID) |
|
ModelCriteria |
groupBy(string $columnName)
Adds a GROUP BY clause to the query Usability layer on top of Criteria::addGroupByColumn() Infers $column $columnName Examples: $c->groupBy('Book.AuthorId') => $c->addGroupByColumn(BookTableMap::AUTHOR_ID) |
|
ModelCriteria |
groupByClass(string $class)
Adds a GROUP BY clause for all columns of a model to the query Examples: $c->groupBy('Book'); => $c->addGroupByColumn(BookTableMap::ID); => $c->addGroupByColumn(BookTableMap::TITLE); => $c->addGroupByColumn(BookTableMap::AUTHOR_ID); => $c->addGroupByColumn(BookTableMap::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 ArrayCollection Examples: ArticleQuery::create()->select('Name')->find(); => ArrayCollection 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(BookTableMap::AUTHOR_ID, AuthorTableMap::ID, Criteria::INNER_JOIN); $c->join('Book.Author', Criteria::RIGHT_JOIN); => $c->addJoin(BookTableMap::AUTHOR_ID, AuthorTableMap::ID, Criteria::RIGHT_JOIN); $c->join('Book.Author a', Criteria::RIGHT_JOIN); => $c->addAlias('a', AuthorTableMap::TABLE_NAME); => $c->addJoin(BookTableMap::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 |
addJoinObject(Join $join, $name = null)
Add a join object to the Criteria |
|
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'); |
|
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 |
|
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 |
|
ModelCriteria |
clear()
Clear the conditions to allow the reuse of the query object. |
|
setPrimaryCriteria(ModelCriteria $criteria, Join $previousJoin)
Sets the primary Criteria for this secondary Criteria |
||
ModelCriteria |
getPrimaryCriteria()
Gets the primary criteria for this secondary Criteria |
|
ModelCriteria |
addSelectQuery(Criteria $subQueryCriteria, string $alias = null, boolean $addAliasAndSelectColumns = true)
Adds a Criteria as subQuery in the From Clause. |
|
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. |
|
ObjectCollection|array|mixed |
find(ConnectionInterface $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(ConnectionInterface $con = null)
Issue a SELECT ... |
|
mixed |
findOneOrCreate(ConnectionInterface $con = null)
Issue a SELECT ... |
|
mixed |
findPk(mixed $key, ConnectionInterface $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, ConnectionInterface $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, ConnectionInterface $con = null)
Apply a condition on a column and issues the SELECT query |
|
mixed |
findByArray(mixed $conditions, ConnectionInterface $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, ConnectionInterface $con = null)
Apply a condition on a column and issues the SELECT ... |
|
mixed |
findOneByArray(mixed $conditions, ConnectionInterface $con = null)
Apply a list of conditions on columns and issues the SELECT ... |
|
integer |
count(ConnectionInterface $con = null)
Issue a SELECT COUNT(*) query based on the current ModelCriteria |
|
doCount($con = null) | ||
PropelModelPager |
paginate(int $page = 1, int $maxPerPage = 10, ConnectionInterface $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 offset and a limit. |
|
integer |
delete(ConnectionInterface $con = null)
Issue a DELETE query based on the current ModelCriteria An optional hook on basePreDelete() can prevent the actual deletion |
|
integer |
deleteAll(ConnectionInterface $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(ConnectionInterface $con = null)
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(mixed $values, ConnectionInterface $con = null, boolean $forceIndividualSaves = false)
Issue an UPDATE query based the current ModelCriteria and a list of changes. |
|
integer |
doUpdate(array $values, ConnectionInterface $con, boolean $forceIndividualSaves = false)
Issue an UPDATE query based the current ModelCriteria and a list of changes. |
|
DataFetcherInterface |
doSelect($con $con = null)
Builds, binds and executes a SELECT query based on the current object. |
|
configureSelectColumns() | ||
string |
getAliasedColName(string $colName)
Changes the table part of a a fully qualified column name if a true model alias exists e.g. |
|
static string |
getShortName(string $fullyQualifiedClassName)
Return the short ClassName for class with namespace |
|
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 createSelectSql() for the cache |
|
__call($name, $arguments)
Handle the magic Supports findByXXX(), findOneByXXX(), filterByXXX(), orderByXXX(), and groupByXXX() methods, where XXX is a column phpName. |
||
__clone()
Ensures deep cloning of attached objects |
||
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
in BaseModelCriteria at line 36
public
__construct(string $dbName = null, string $modelName = null, string $modelAlias = null)
Creates a new instance with the default capacity which corresponds to the specified database.
in BaseModelCriteria at line 51
public array
getWith()
Gets the array of ModelWith specifying which objects must be hydrated together with the main object.
in BaseModelCriteria at line 64
public ModelCriteria
setWith(array $with)
Sets the array of ModelWith specifying which objects must be hydrated together with the main object.
in BaseModelCriteria at line 84
public ModelCriteria
setFormatter(string|AbstractFormatter $formatter)
Sets the formatter to use for the find() output Formatters must extend AbstractFormatter Use the ModelCriteria constants for class names: <code> $c->setFormatter(ModelCriteria::FORMAT_ARRAY); </code>
in BaseModelCriteria at line 105
public AbstractFormatter
getFormatter()
Gets the formatter to use for the find() output Defaults to an instance of ModelCriteria::$defaultFormatterClass, i.e.
PropelObjectsFormatter
in BaseModelCriteria at line 120
public string
getModelName()
Returns the name of the class for this model criteria
in BaseModelCriteria at line 133
public ModelCriteria
setModelName(string $modelName)
Sets the model name.
This also sets `this->modelTableMapName` and `this->tableMap`.
in BaseModelCriteria at line 150
public
getFullyQualifiedModelName()
in BaseModelCriteria at line 163
public ModelCriteria
setModelAlias(string $modelAlias, boolean $useAliasInSQL = false)
Sets the alias for the model in this query
in BaseModelCriteria at line 180
public string
getModelAlias()
Returns the alias of the main class for this model criteria
in BaseModelCriteria at line 190
public string
getModelAliasOrName()
Return the string to use in a clause as a model prefix for the main model
in BaseModelCriteria at line 200
public string
getModelShortName()
Return The short model name (the short ClassName for class with namespace)
in BaseModelCriteria at line 210
public TableMap
getTableMap()
Returns the TableMap object for this Criteria
in BaseModelCriteria at line 226
public Traversable
getIterator()
Execute the query with a find(), and return a Traversable object.
The return value depends on the query formatter. By default, this returns an ArrayIterator
constructed on a Propel\Runtime\Collection\PropelCollection.
Compulsory for implementation of \IteratorAggregate.
at line 96
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 119
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 141
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 170
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 205
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 235
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(BookTableMap::CREATED_AT) $c->orderBy('Book.CategoryId', 'desc') => $c->addDescendingOrderByColumn(BookTableMap::CATEGORY_ID)
at line 265
public ModelCriteria
groupBy(string $columnName)
Adds a GROUP BY clause to the query Usability layer on top of Criteria::addGroupByColumn() Infers $column $columnName Examples: $c->groupBy('Book.AuthorId') => $c->addGroupByColumn(BookTableMap::AUTHOR_ID)
at line 286
public ModelCriteria
groupByClass(string $class)
Adds a GROUP BY clause for all columns of a model to the query Examples: $c->groupBy('Book'); => $c->addGroupByColumn(BookTableMap::ID); => $c->addGroupByColumn(BookTableMap::TITLE); => $c->addGroupByColumn(BookTableMap::AUTHOR_ID); => $c->addGroupByColumn(BookTableMap::PUBLISHER_ID);
at line 315
public ModelCriteria
distinct()
Adds a DISTINCT clause to the query Alias for Criteria::setDistinct()
at line 330
public ModelCriteria
limit(int $limit)
Adds a LIMIT clause (or its subselect equivalent) to the query Alias for Criteria:::setLimit()
at line 345
public ModelCriteria
offset(int $offset)
Adds an OFFSET clause (or its subselect equivalent) to the query Alias for of Criteria::setOffset()
at line 374
public ModelCriteria
select(mixed $columnArray)
Makes the ModelCriteria return a string, array, or ArrayCollection Examples: ArticleQuery::create()->select('Name')->find(); => ArrayCollection Object ('Foo', 'Bar')
ArticleQuery::create()->select('Name')->findOne();
=> string 'Foo'
ArticleQuery::create()->select(array('Id', 'Name'))->find();
=> ArrayCollection 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 398
public array|string
getSelect()
Retrieves the columns defined by a previous call to select().
at line 409
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 420
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 432
public Join
getJoin(string $name)
This method returns an already defined join clause from the query
at line 458
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(BookTableMap::AUTHOR_ID, AuthorTableMap::ID, Criteria::INNER_JOIN); $c->join('Book.Author', Criteria::RIGHT_JOIN); => $c->addJoin(BookTableMap::AUTHOR_ID, AuthorTableMap::ID, Criteria::RIGHT_JOIN); $c->join('Book.Author a', Criteria::RIGHT_JOIN); => $c->addAlias('a', AuthorTableMap::TABLE_NAME); => $c->addJoin(BookTableMap::AUTHOR_ID, 'a.ID', Criteria::RIGHT_JOIN); </code>
at line 527
public ModelCriteria
addJoinCondition($name, $clause, $value = null, $operator = null, $bindingType = null)
Add another condition to an already added join
at line 559
public ModelCriteria
setJoinCondition(string $name, mixed $condition)
Replace the condition of an already added join
at line 583
public ModelCriteria
addJoinObject(Join $join, $name = null)
Add a join object to the Criteria
at line 613
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 639
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 666
public
isWithOneToMany()
at line 683
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 709
public ModelCriteria
useQuery($relationName, $secondaryCriteriaClass = null)
Initializes a secondary ModelCriteria object, to be later merged with the current object
at line 738
public ModelCriteria
endUse()
Finalizes a secondary criteria and merges it with its primary Criteria
at line 761
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
at line 779
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.
at line 795
public
setPrimaryCriteria(ModelCriteria $criteria, Join $previousJoin)
Sets the primary Criteria for this secondary Criteria
at line 806
public ModelCriteria
getPrimaryCriteria()
Gets the primary criteria for this secondary Criteria
at line 822
public ModelCriteria
addSelectQuery(Criteria $subQueryCriteria, string $alias = null, boolean $addAliasAndSelectColumns = true)
Adds a Criteria as subQuery in the From Clause.
at line 849
public ModelCriteria
addSelfSelectColumns()
Adds the select columns for a the current table
at line 863
public ModelCriteria
addRelationSelectColumns(string $relation)
Adds the select columns for a relation
at line 880
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 901
static public string
getRelationName(string $relation)
Returns the name of a relation from a string.
The input looks like '$leftName.$relationName $relationAlias'
at line 926
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.
at line 938
public boolean
isKeepQuery()
Checks whether the automated cloning on termination is enabled.
at line 966
public ObjectCollection|array|mixed
find(ConnectionInterface $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 990
public mixed
findOne(ConnectionInterface $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 1018
public mixed
findOneOrCreate(ConnectionInterface $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 1050
public mixed
findPk(mixed $key, ConnectionInterface $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 1092
public mixed
findPks(array $keys, ConnectionInterface $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 1126
public mixed
findBy(string $column, mixed $value, ConnectionInterface $con = null)
Apply a condition on a column and issues the SELECT query
at line 1151
public mixed
findByArray(mixed $conditions, ConnectionInterface $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 1170
public mixed
findOneBy(mixed $column, mixed $value, ConnectionInterface $con = null)
Apply a condition on a column and issues the SELECT ...
LIMIT 1 query
at line 1195
public mixed
findOneByArray(mixed $conditions, ConnectionInterface $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 1209
public integer
count(ConnectionInterface $con = null)
Issue a SELECT COUNT(*) query based on the current ModelCriteria
at line 1236
public
doCount($con = null)
at line 1259
public PropelModelPager
paginate(int $page = 1, int $maxPerPage = 10, ConnectionInterface $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 offset and a limit.
at line 1308
public integer
delete(ConnectionInterface $con = null)
Issue a DELETE query based on the current ModelCriteria An optional hook on basePreDelete() can prevent the actual deletion
at line 1346
public integer
deleteAll(ConnectionInterface $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 1376
public integer
doDeleteAll(ConnectionInterface $con = null)
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 1459
public integer
update(mixed $values, ConnectionInterface $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 1505
public integer
doUpdate(array $values, ConnectionInterface $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 1806
public DataFetcherInterface
doSelect($con $con = null)
Builds, binds and executes a SELECT query based on the current object.
at line 1823
public
configureSelectColumns()
at line 1919
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 1935
static public string
getShortName(string $fullyQualifiedClassName)
Return the short ClassName for class with namespace
at line 1952
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 1964
public array
getParams()
Get all the parameters to bind to this criteria Does part of the job of createSelectSql() for the cache
at line 2007
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 2068
public
__clone()
Ensures deep cloning of attached objects
at line 53
ModelCriteria
leftJoin($relation)
Adds a LEFT JOIN clause to the query
at line 53
ModelCriteria
rightJoin($relation)
Adds a RIGHT JOIN clause to the query
at line 53
ModelCriteria
innerJoin($relation)
Adds a INNER JOIN clause to the query