Skip to content

Commit

Permalink
UnionQuery: Expect a model to define which relations are required
Browse files Browse the repository at this point in the history
  • Loading branch information
nilmerg committed Mar 6, 2020
1 parent d005dd6 commit 99e8756
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/UnionQuery.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,12 @@ public function getUnions()
if ($this->unions === null) {
$this->unions = [];

foreach ($this->getModel()->getUnions() as list($target, $columns)) {
foreach ($this->getModel()->getUnions() as list($target, $relations, $columns)) {
$query = (new Query())
->setDb($this->getDb())
->setModel(new $target())
->columns($columns);
->columns($columns)
->with($relations);

$this->unions[] = $query;
}
Expand Down

0 comments on commit 99e8756

Please sign in to comment.