Skip to content

Commit

Permalink
Further regression-fixes from rebasing
Browse files Browse the repository at this point in the history
  • Loading branch information
cmacmackin committed Nov 19, 2023
1 parent d452b99 commit 3cbc3ab
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
2 changes: 1 addition & 1 deletion meta/Search.php
Original file line number Diff line number Diff line change
Expand Up @@ -581,7 +581,7 @@ protected function runSQLBuilder()
{
$sqlBuilder = new SearchSQLBuilder();
$sqlBuilder->setSelectLatest($this->selectLatest);
$sqlBuilder->addSchemas($this->schemas);
$sqlBuilder->addSchemas($this->schemas, $this->joins);
$sqlBuilder->addColumns($this->columns);
$sqlBuilder->addFilters($this->filter);
$sqlBuilder->addFilters($this->dynamicFilter);
Expand Down
9 changes: 5 additions & 4 deletions meta/SearchSQLBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,9 @@ public function __construct()
* Add the schemas to the query
*
* @param Schema[] $schemas Schema names to query
* @param array $joins Conditionals to be used when joining tables
*/
public function addSchemas($schemas)
public function addSchemas($schemas, $joins)
{
// basic tables
$first_table = '';
Expand All @@ -38,10 +39,10 @@ public function addSchemas($schemas)
$new_pid = false;
if ($first_table) {
// follow up tables
[$lcol, $rcol] = $this->joins[$schema->getTable()];
[$lcol, $rcol] = $joins[$schema->getTable()];
if ($lcol->getLabel() == '%pageid%' and $rcol->getLabel() == '%pageid%') {
// Simple (default) case where we join on page IDs
$QB->addLeftJoin($first_table, $datatable, $datatable, "$first_table.pid = $datatable.pid");
$this->qb->addLeftJoin($first_table, $datatable, $datatable, "$first_table.pid = $datatable.pid");
} else {
// Custom join on some other columns
$lefttable = 'data_' . $lcol->getTable();
Expand All @@ -50,7 +51,7 @@ public function addSchemas($schemas)
$lefttable, $lcol->getColName(), $righttable,
$rcol->getColName(), $rcol->getType()
);
$QB->addLeftJoin($lefttable, $righttable, $righttable, $on);
$this->qb->addLeftJoin($lefttable, $righttable, $righttable, $on);
}
} else {
// first table
Expand Down

0 comments on commit 3cbc3ab

Please sign in to comment.