diff --git a/db/ActiveQuery.php b/db/ActiveQuery.php index 371eb24e079..0ab66283e1f 100644 --- a/db/ActiveQuery.php +++ b/db/ActiveQuery.php @@ -811,6 +811,10 @@ public function getTablesUsedInFrom() // Clean up table names and aliases $cleanedUpTableNames = []; foreach ($tableNames as $alias => $tableName) { + if (preg_match('~{{(.*?)}}~', $tableName, $matches)) { + $alias = $tableName = $matches[1]; + } + if (!is_string($alias)) { if (preg_match('~^\s*([\'"`\[].*?[\'"`\]]|\w+)(?:(?:\s+(?:as)?\s*)([\'"`\[].*?[\'"`\]]|\w+))?\s*$~iu', $tableName, $matches)) { if (isset($matches[1])) {