1
0
mirror of https://github.com/processwire/processwire.git synced 2025-08-12 01:34:31 +02:00
This commit is contained in:
Ryan Cramer
2021-06-01 11:31:44 -04:00
parent bb5d846b04
commit 91cb5c0e21

View File

@@ -732,8 +732,13 @@ class PagesRawFinder extends Wire {
$idsCSV = &$this->ids;
$colSQL = $getAllCols ? '*' : '`' . implode('`,`', $getCols) . '`';
if(!$getAllCols && !in_array('pages_id', $getCols)) $colSQL .= ',`pages_id`';
$orderby = array();
if(!count($this->nativeFields)) $orderby[] = "FIELD(pages_id, $idsCSV)";
if(count($sorts)) $orderby[] = implode(',', $sorts);
$sql = "SELECT $colSQL FROM `$table` WHERE pages_id IN($idsCSV) ";
if(count($sorts)) $sql .= "ORDER BY " . implode(',', $sorts);
if(count($orderby)) $sql .= "ORDER BY " . implode(',', $orderby);
$query = $database->prepare($sql);
$query->execute();