Commit 2d3ac6b4 by Qiang Xue

Fixes #1638: prevent table names from being enclosed within curly brackets twice.

parent da78b6e1
......@@ -366,12 +366,18 @@ class ActiveQuery extends Query implements ActiveQueryInterface
$parentTable = $this->getQueryTableName($parent);
$childTable = $this->getQueryTableName($child);
if (strpos($parentTable, '{{') === false) {
$parentTable = '{{' . $parentTable . '}}';
}
if (strpos($childTable, '{{') === false) {
$childTable = '{{' . $childTable . '}}';
}
if (!empty($child->link)) {
$on = [];
foreach ($child->link as $childColumn => $parentColumn) {
$on[] = '{{' . $parentTable . "}}.[[$parentColumn]] = {{" . $childTable . "}}.[[$childColumn]]";
$on[] = "$parentTable.[[$parentColumn]] = $childTable.[[$childColumn]]";
}
$on = implode(' AND ', $on);
} else {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment