mirror of
https://github.com/yiisoft/yii2.git
synced 2025-11-03 05:48:11 +08:00
Fixes #15353: Remove side effect of ActiveQuery::getTablesUsedInFrom() introduced in 2.0.13
This commit is contained in:
committed by
Alexander Makarov
parent
6c0540aa2d
commit
f8990ac97a
@ -809,7 +809,7 @@ class ActiveQuery extends Query implements ActiveQueryInterface
|
||||
public function getTablesUsedInFrom()
|
||||
{
|
||||
if (empty($this->from)) {
|
||||
$this->from = [$this->getPrimaryTableName()];
|
||||
return $this->cleanUpTableNames([$this->getPrimaryTableName()]);
|
||||
}
|
||||
|
||||
return parent::getTablesUsedInFrom();
|
||||
|
||||
@ -479,7 +479,18 @@ class Query extends Component implements QueryInterface
|
||||
throw new InvalidConfigException(gettype($this->from) . ' in $from is not supported.');
|
||||
}
|
||||
|
||||
// Clean up table names and aliases
|
||||
return $this->cleanUpTableNames($tableNames);
|
||||
}
|
||||
|
||||
/**
|
||||
* Clean up table names and aliases
|
||||
* Both aliases and names are enclosed into {{ and }}.
|
||||
* @param array $tableNames non-empty array
|
||||
* @return string[] table names indexed by aliases
|
||||
* @since 2.0.14
|
||||
*/
|
||||
protected function cleanUpTableNames($tableNames)
|
||||
{
|
||||
$cleanedUpTableNames = [];
|
||||
foreach ($tableNames as $alias => $tableName) {
|
||||
if (is_string($tableName) && !is_string($alias)) {
|
||||
|
||||
Reference in New Issue
Block a user