mirror of
https://github.com/Icinga/icingaweb2.git
synced 2025-07-30 09:14:08 +02:00
DbRepository: Do not attempt to join virtual tables multiple times
This commit is contained in:
parent
327cf37326
commit
dd069288e9
@ -576,6 +576,21 @@ abstract class DbRepository extends Repository implements Extensible, Updatable,
|
|||||||
return $this->prependTablePrefix($this->applyTableAlias($table, $virtualTable));
|
return $this->prependTablePrefix($this->applyTableAlias($table, $virtualTable));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return the alias for the given table or null if none has been defined
|
||||||
|
*
|
||||||
|
* @param string $table
|
||||||
|
*
|
||||||
|
* @return string|null
|
||||||
|
*/
|
||||||
|
public function resolveTableAlias($table)
|
||||||
|
{
|
||||||
|
$tableAliases = $this->getTableAliases();
|
||||||
|
if (isset($tableAliases[$table])) {
|
||||||
|
return $tableAliases[$table];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Recurse the given filter, require each column for the given table and convert all values
|
* Recurse the given filter, require each column for the given table and convert all values
|
||||||
*
|
*
|
||||||
@ -828,8 +843,10 @@ abstract class DbRepository extends Repository implements Extensible, Updatable,
|
|||||||
$column = $name;
|
$column = $name;
|
||||||
}
|
}
|
||||||
|
|
||||||
$prefixedTableName = $this->prependTablePrefix($tableName);
|
if (($joinIdentifier = $this->resolveTableAlias($tableName)) === null) {
|
||||||
if ($query->getQuery()->hasJoinedTable($prefixedTableName)) {
|
$joinIdentifier = $this->prependTablePrefix($tableName);
|
||||||
|
}
|
||||||
|
if ($query->getQuery()->hasJoinedTable($joinIdentifier)) {
|
||||||
return $column;
|
return $column;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user