more tests for joinWith alias

also test on joining the same relation twice
This commit is contained in:
Carsten Brandt
2016-02-12 01:16:11 +01:00
parent 94571e2c23
commit 3f8df39f45
4 changed files with 113 additions and 6 deletions

View File

@@ -641,6 +641,7 @@ class ActiveQuery extends Query implements ActiveQueryInterface
if (!empty($child->join)) {
foreach ($child->join as $join) {
$this->join[] = $join;
$this->populateAliases((array) $join[1]);
}
}
if (!empty($child->union)) {

View File

@@ -851,7 +851,7 @@ class Query extends Component implements QueryInterface
*/
public static function create($from)
{
return new self([
$query = new self([
'where' => $from->where,
'limit' => $from->limit,
'offset' => $from->offset,
@@ -867,5 +867,7 @@ class Query extends Component implements QueryInterface
'union' => $from->union,
'params' => $from->params,
]);
$query->_aliases = $from->_aliases;
return $query;
}
}