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 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
|
||||
*
|
||||
|
@ -828,8 +843,10 @@ abstract class DbRepository extends Repository implements Extensible, Updatable,
|
|||
$column = $name;
|
||||
}
|
||||
|
||||
$prefixedTableName = $this->prependTablePrefix($tableName);
|
||||
if ($query->getQuery()->hasJoinedTable($prefixedTableName)) {
|
||||
if (($joinIdentifier = $this->resolveTableAlias($tableName)) === null) {
|
||||
$joinIdentifier = $this->prependTablePrefix($tableName);
|
||||
}
|
||||
if ($query->getQuery()->hasJoinedTable($joinIdentifier)) {
|
||||
return $column;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue