Skip to content

Instantly share code, notes, and snippets.

@davidpede
Last active April 26, 2018 10:06
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save davidpede/9cf88dfd20664669ddf40828eec0662f to your computer and use it in GitHub Desktop.
Save davidpede/9cf88dfd20664669ddf40828eec0662f to your computer and use it in GitHub Desktop.
XPDO Select Examples
$query = $this->modx->newQuery('modUser');
$query->innerJoin('modUserProfile','Profile');
//Select ALL fields from both tables
$query->select(array('modUser.*, Profile.*'));
---
$query->select(array('modUser.*'));
$query->select($this->modx->getSelectColumns('modUserProfile','Profile','profile_'));
//Select SPECIFIC fields from both tables
$query->select('modUser.id,Profile.email,Profile.fullname');
---
$query->select('modUser.id,Profile.email AS profile_email,Profile.fullname');
---
$query->select(array('modUser.*'));
$query->select($xpdo->getSelectColumns('className','alias','prefix_',array('email','fullname')));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment