Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
UnionExpression.php
Go to the documentation of this file.
1 <?php
7 
9 
14 {
18  protected $parts;
19 
23  protected $type;
24 
29  public function __construct(array $parts, $type = Select::SQL_UNION)
30  {
31  $this->parts = $parts;
32  $this->type = $type;
33  }
34 
38  public function __toString()
39  {
40  $parts = [];
41  foreach ($this->parts as $part) {
42  if ($part instanceof Select) {
43  $parts[] = sprintf('(%s)', $part->assemble());
44  } else {
45  $parts[] = $part;
46  }
47  }
48  return implode($parts, $this->type);
49  }
50 }
__construct(array $parts, $type=Select::SQL_UNION)
const SQL_UNION
Definition: Select.php:68