Jump to main content Jump to doc navigation

xPDOQuery.leftJoin

Other versions: 3.x — Found a problem? Please edit this page or report an issue.

xPDOQuery::leftJoin

Adds a LEFT JOIN clause to the query.

Syntax

API Docs: http://api.modx.com/revolution/2.2/db_core_xpdo_om_xpdoquery.class.html#\xPDOQuery::leftJoin()

void leftJoin ( $class, [ $alias = ''], [ $conditions = array ()], [ $conjunction = xPDOQuery::SQL_AND], [ $binding = null], [ $condGroup = 0])

Example

Select all Boxes and the Owner name.

$query = $xpdo->newQuery('Box');
$query->select($xpdo->getSelectColumns('Box'));
$query->select(array(
  'Owner.name'
));
$query->leftJoin('Owner','Owner');
$boxes = $xpdo->getCollection('Box',$query);

See Also