Jump to main content Jump to doc navigation

xPDO::getSelectColumns

Builds a comma-delimited list of the columns to select for a class, optionally qualified with a table alias and a column prefix. This is the list that xPDOQuery::select() expands when it receives '*'.

Syntax

string getSelectColumns (string $className, [string $tableAlias = ''], [string $columnPrefix = ''], [array $columns = array()], [boolean $exclude = false])
  • $className — the class whose columns to list.
  • $tableAlias — optional alias to qualify each column with.
  • $columnPrefix — optional prefix added to each column name (used to avoid collisions when joining).
  • $columns — an explicit list of columns; if empty, all fields of the class are used.
  • $exclude — when true, the listed columns are excluded rather than selected.

Example

$columns = $xpdo->getSelectColumns('Box', 'Box', 'Box_');
// Box.id, Box.name, Box.width, ...

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
  • A. Moreno
  • Alex
  • Chris Fickling
  • Stéphane Jäggi
  • YJ
  • Murray Wood
  • JT Skaggs
  • Anton Tarasov
  • deJaya
  • Lefthandmedia
  • eydolan
  • Following Sea
  • Guido Gallenkamp
  • Raffy
  • Snow Creative
  • Nick Clark
  • Guest
  • Helen
  • krisznet
  • Yanni
  • Richard

Budget

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

Learn more