| Total Complexity | 4 |
| Total Lines | 35 |
| Duplicated Lines | 0 % |
| Changes | 0 | ||
| 1 | <?php declare(strict_types=1); |
||
| 9 | trait UnionTrait |
||
| 10 | { |
||
| 11 | /** |
||
| 12 | * @var array |
||
| 13 | */ |
||
| 14 | protected $unionAll = []; |
||
| 15 | |||
| 16 | /** |
||
| 17 | * @param QueryBuilderInterface $queryBuilder |
||
| 18 | * |
||
| 19 | * @return $this |
||
| 20 | * @throws QueryBuilderException |
||
| 21 | */ |
||
| 22 | public function unionAll(QueryBuilderInterface $queryBuilder) |
||
| 23 | { |
||
| 24 | if (CommandEnum::SELECT != $queryBuilder->commandData()) { |
||
| 25 | throw new QueryBuilderException(\sprintf( |
||
| 26 | '$queryBuilder should be with valid command! Valid command: "%s"', |
||
| 27 | CommandEnum::SELECT |
||
| 28 | )); |
||
| 29 | } |
||
| 30 | |||
| 31 | $this->unionAll[] = \sprintf('(%s)', $queryBuilder->buildQuery()); |
||
| 32 | |||
| 33 | $this->bind($queryBuilder->bindData()); |
||
|
|
|||
| 34 | |||
| 35 | return $this; |
||
| 36 | } |
||
| 37 | |||
| 38 | /** |
||
| 39 | * @return null|string |
||
| 40 | */ |
||
| 41 | protected function buildUnionAllQueryPart(): ?string |
||
| 44 | } |
||
| 45 | } |
||
| 46 |