Propel API
Class

Join

class Join

Data object to describe a join between two tables, for example <pre> table_a LEFT JOIN table_b ON table_a.id = table_b.a_id </pre>

Constants

EQUAL

INNER_JOIN

Methods

__construct(string $leftColumn = null, string $rightColumn = null, string $joinType = null)

Constructor Use it preferably with no arguments, and then use addCondition() and setJoinType() Syntax with arguments used mainly for backwards compatibility

addCondition(string $left, string $right, string $operator = self::EQUAL)

Join condition definition.

addConditions(array $lefts, array $rights, array $operators = array())

Join condition definition, for several conditions

addExplicitCondition(string $leftTableName, string $leftColumnName, string $leftTableAlias = null, string $rightTableName, string $rightColumnName, string $rightTableAlias = null, string $operator = self::EQUAL)

Join condition definition.

integer countConditions()

Retrieve the number of conditions in the join

array getConditions()

Return an array of the join conditions

addOperator(string $operator = null)

the getOperator($index)

getOperators()

setJoinType(string $joinType = null)

Set the join type

string getJoinType()

Get the join type

addLeftColumnName(string $left)

Add a left column name to the join condition

string getLeftColumn(integer $index)

Get the fully qualified name of the left column of the join condition

string getLeftColumnName(integer $index)

Get the left column name of the join condition

array getLeftColumns()

Get the list of all the names of left columns of the join condition

setLeftTableName($leftTableName)

getLeftTableName()

setLeftTableAlias($leftTableAlias)

getLeftTableAlias()

hasLeftTableAlias()

getLeftTableAliasOrName()

getLeftTableWithAlias()

addRightColumnName(string $right)

Add a right column name to the join condition

string getRightColumn(integer $index)

Get the fully qualified name of the right column of the join condition

string getRightColumnName(integer $index)

Get the right column name of the join condition

all getRightColumns()

setRightTableName($rightTableName)

getRightTableName()

setRightTableAlias($rightTableAlias)

getRightTableAlias()

hasRightTableAlias()

getRightTableAliasOrName()

getRightTableWithAlias()

DBAdapter getDB()

Get the value of db.

void setDB(DBAdapter $db)

Set the value of db.

setJoinCondition(Criterion $joinCondition)

Set a custom join condition

Criterion getJoinCondition()

Get the custom join condition, if previously set

buildJoinCondition(Criteria $c)

Set the custom join condition Criterion based on the conditions of this join

string getClause(array $params)

Get the join clause for this Join.

equals($join)

string toString()

Returns a String representation of the class,

__toString()

Details

at line 71
public __construct(string $leftColumn = null, string $rightColumn = null, string $joinType = null)

Constructor Use it preferably with no arguments, and then use addCondition() and setJoinType() Syntax with arguments used mainly for backwards compatibility

Parameters

string $leftColumn The left column of the join condition (may contain an alias name)
string $rightColumn The right column of the join condition (may contain an alias name)
string $joinType The type of the join. Valid join types are null (implicit join), Criteria::LEFT_JOIN, Criteria::RIGHT_JOIN, and Criteria::INNER_JOIN

at line 97
public addCondition(string $left, string $right, string $operator = self::EQUAL)

Join condition definition.

Warning: doesn't support table aliases. Use the explicit methods to use aliases.

Parameters

string $left The left column of the join condition (may contain an alias name)
string $right The right column of the join condition (may contain an alias name)
string $operator The comparison operator of the join condition, default Join::EQUAL

at line 122
public addConditions(array $lefts, array $rights, array $operators = array())

Join condition definition, for several conditions

Parameters

array $lefts The left columns of the join condition
array $rights The right columns of the join condition
array $operators The comparison operators of the join condition, default Join::EQUAL

Exceptions

PropelException

at line 151
public addExplicitCondition(string $leftTableName, string $leftColumnName, string $leftTableAlias = null, string $rightTableName, string $rightColumnName, string $rightTableAlias = null, string $operator = self::EQUAL)

Join condition definition.

Parameters

string $leftTableName
string $leftColumnName
string $leftTableAlias
string $rightTableName
string $rightColumnName
string $rightTableAlias
string $operator The comparison operator of the join condition, default Join::EQUAL

at line 168
public integer countConditions()

Retrieve the number of conditions in the join

Return Value

integer The number of conditions in the join

at line 178
public array getConditions()

Return an array of the join conditions

Return Value

array An array of arrays representing (left, comparison, right) for each condition

at line 195
public addOperator(string $operator = null)

Parameters

string $operator the comparison operator for the join condition

at line 203
public the getOperator($index)

Parameters

$index

Return Value

the comparison operator for the join condition

at line 208
public getOperators()

at line 220
public setJoinType(string $joinType = null)

Set the join type

Parameters

string $joinType The type of the join. Valid join types are null (adding the join condition to the where clause), Criteria::LEFT_JOIN(), Criteria::RIGHT_JOIN(), and Criteria::INNER_JOIN()

at line 231
public string getJoinType()

Get the join type

Return Value

string The type of the join, i.e. Criteria::LEFT_JOIN(), ..., or null for adding the join condition to the where Clause

at line 246
public addLeftColumnName(string $left)

Add a left column name to the join condition

Parameters

string $left The name of the left column to add

at line 262
public string getLeftColumn(integer $index)

Get the fully qualified name of the left column of the join condition

Parameters

integer $index The number of the condition to use

Return Value

string

at line 280
public string getLeftColumnName(integer $index)

Get the left column name of the join condition

Parameters

integer $index The number of the condition to use

Return Value

string

at line 289
public array getLeftColumns()

Get the list of all the names of left columns of the join condition

Return Value

array

at line 299
public setLeftTableName($leftTableName)

Parameters

$leftTableName

at line 306
public getLeftTableName()

at line 311
public setLeftTableAlias($leftTableAlias)

Parameters

$leftTableAlias

at line 318
public getLeftTableAlias()

at line 323
public hasLeftTableAlias()

at line 328
public getLeftTableAliasOrName()

at line 333
public getLeftTableWithAlias()

at line 348
public addRightColumnName(string $right)

Add a right column name to the join condition

Parameters

string $right The name of the right column to add

at line 364
public string getRightColumn(integer $index)

Get the fully qualified name of the right column of the join condition

Parameters

integer $index The number of the condition to use

Return Value

string

at line 382
public string getRightColumnName(integer $index)

Get the right column name of the join condition

Parameters

integer $index The number of the condition to use

Return Value

string

at line 390
public all getRightColumns()

Return Value

all right columns of the join condition

at line 400
public setRightTableName($rightTableName)

Parameters

$rightTableName

at line 407
public getRightTableName()

at line 412
public setRightTableAlias($rightTableAlias)

Parameters

$rightTableAlias

at line 419
public getRightTableAlias()

at line 424
public hasRightTableAlias()

at line 429
public getRightTableAliasOrName()

at line 434
public getRightTableWithAlias()

at line 445
public DBAdapter getDB()

Get the value of db.

The DBAdapter which might be used to get db specific
variations of sql.

Return Value

DBAdapter value of db.

at line 456
public void setDB(DBAdapter $db)

Set the value of db.

The DBAdapter might be used to get db specific variations of sql.

Parameters

DBAdapter $db Value to assign to db.

Return Value

void

at line 466
public setJoinCondition(Criterion $joinCondition)

Set a custom join condition

Parameters

Criterion $joinCondition a Join condition

at line 476
public Criterion getJoinCondition()

Get the custom join condition, if previously set

Return Value

Criterion

at line 486
public buildJoinCondition(Criteria $c)

Set the custom join condition Criterion based on the conditions of this join

Parameters

Criteria $c A Criteria object to get Criterions from

at line 516
public string getClause(array $params)

Get the join clause for this Join.

If the join condition needs binding, uses the passed params array.

Parameters

array $params &$params

Return Value

string SQL join clause with join condition

at line 542
public equals($join)

Parameters

$join

at line 555
public string toString()

Returns a String representation of the class,

Return Value

string A String representation of the class

at line 562
public __toString()