Jump to main content Jump to doc navigation

xPDOQuery::join

Adds a join clause to the query with an explicit join type. The dedicated methods innerJoin(), leftJoin() and rightJoin() are shorter forms of this method.

Syntax

xPDOQuery join (string $class, [string $alias = ''], [string $type = xPDOQuery::SQL_JOIN_CROSS], [mixed $conditions = array()], [string $conjunction = xPDOQuery::SQL_AND], [mixed $binding = null], [integer $condGroup = 0])

$type accepts the class constants SQL_JOIN_CROSS, SQL_JOIN_LEFT, SQL_JOIN_RIGHT, SQL_JOIN_NATURAL_LEFT, SQL_JOIN_NATURAL_RIGHT and SQL_JOIN_STRAIGHT.

Example

$query = $xpdo->newQuery('Box');
$query->join('Owner', 'Owner', xPDOQuery::SQL_JOIN_LEFT, array('Owner.id:=' => 'Box.owner_id'));

See Also

Support the team building MODX with a monthly donation.

The budget raised through OpenCollective is transparent, including payouts, and any contributor can apply to be paid for their work on MODX.

Backers

  • modmore
  • STERC
  • Digital Penguin
  • Jens Wittmann – Gestaltung & Entwicklung
  • CrewMark
  • Fabian Christen
  • Sepia River Studios
  • Dannevang Digital
  • Alex
  • A. Moreno
  • Chris Fickling
  • Stéphane Jäggi
  • Murray Wood
  • Anton Tarasov
  • JT Skaggs
  • deJaya
  • Lefthandmedia
  • eydolan
  • Following Sea
  • Guido Gallenkamp
  • YJ
  • Raffy
  • Snow Creative
  • Nick Clark
  • Guest
  • Helen
  • krisznet
  • Yanni
  • Richard

Budget

$194 per month—let's make that $500!

Learn more