diff --git a/src/UnionQuery.php b/src/UnionQuery.php index b976c67..febc375 100644 --- a/src/UnionQuery.php +++ b/src/UnionQuery.php @@ -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; }