Commit 01c89ea3 by Ivan Pomortsev

Update Query.php

Change union method to accept also <code>$all</code> variable. TRUE means that we must results <code>UNION ALL</code> construction, FALSE – that <code>UNION</code>.
parent 1ea895e2
...@@ -635,10 +635,12 @@ class Query extends Component implements QueryInterface ...@@ -635,10 +635,12 @@ class Query extends Component implements QueryInterface
/** /**
* Appends a SQL statement using UNION operator. * Appends a SQL statement using UNION operator.
* @param string|Query $sql the SQL statement to be appended using UNION * @param string|Query $sql the SQL statement to be appended using UNION
* @param bool $all TRUE if using UNION ALL and FALSE if using UNION
* @return static the query object itself * @return static the query object itself
*/ */
public function union($sql) public function union($sql, $all = false)
{ {
$sql->addParams([ 'all' => $all ])
$this->union[] = $sql; $this->union[] = $sql;
return $this; return $this;
} }
......
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