1 | <?php |
||
20 | class SelectQuery extends AbstractSelect implements \JsonSerializable |
||
21 | { |
||
22 | /** |
||
23 | * Table names to select data from. |
||
24 | * |
||
25 | * @var array |
||
26 | */ |
||
27 | protected $tables = []; |
||
28 | |||
29 | /** |
||
30 | * Select queries represented by sql fragments or query builders to be united. Stored as |
||
31 | * [UNION TYPE, SELECT QUERY]. |
||
32 | * |
||
33 | * @var array |
||
34 | */ |
||
35 | protected $unionTokens = []; |
||
36 | |||
37 | /** |
||
38 | * {@inheritdoc} |
||
39 | * |
||
40 | * @param array $from Initial set of table names. |
||
41 | * @param array $columns Initial set of columns to fetch. |
||
42 | */ |
||
43 | public function __construct( |
||
56 | |||
57 | /** |
||
58 | * Set table names SELECT query should be performed for. Table names can be provided with |
||
59 | * specified alias (AS construction). |
||
60 | * |
||
61 | * @param array|string|mixed $tables Array of names, comma separated string or set of |
||
62 | * parameters. |
||
63 | * |
||
64 | * @return self|$this |
||
65 | */ |
||
66 | public function from($tables): SelectQuery |
||
72 | |||
73 | /** |
||
74 | * Set columns should be fetched as result of SELECT query. Columns can be provided with |
||
75 | * specified alias (AS construction). |
||
76 | * |
||
77 | * @param array|string|mixed $columns Array of names, comma separated string or set of |
||
78 | * parameters. |
||
79 | * |
||
80 | * @return self|$this |
||
81 | */ |
||
82 | public function columns($columns): SelectQuery |
||
88 | |||
89 | /** |
||
90 | * Alias for columns() method. |
||
91 | * |
||
92 | * @param array|string|mixed $columns Array of names, comma separated string or set of |
||
93 | * parameters. |
||
94 | * |
||
95 | * @return self|$this |
||
96 | */ |
||
97 | public function select($columns): SelectQuery |
||
103 | |||
104 | /** |
||
105 | * Add select query to be united with. |
||
106 | * |
||
107 | * @param FragmentInterface $query |
||
108 | * |
||
109 | * @return self|$this |
||
110 | */ |
||
111 | public function union(FragmentInterface $query): SelectQuery |
||
117 | |||
118 | /** |
||
119 | * Add select query to be united with. Duplicate values will be included in result. |
||
120 | * |
||
121 | * @param FragmentInterface $query |
||
122 | * |
||
123 | * @return self|$this |
||
124 | */ |
||
125 | public function unionAll(FragmentInterface $query): SelectQuery |
||
131 | |||
132 | /** |
||
133 | * {@inheritdoc} |
||
134 | */ |
||
135 | public function getParameters(QueryCompiler $compiler = null): array |
||
150 | |||
151 | /** |
||
152 | * {@inheritdoc} |
||
153 | */ |
||
154 | public function sqlStatement(QueryCompiler $compiler = null): string |
||
175 | |||
176 | /** |
||
177 | * {@inheritdoc} |
||
178 | */ |
||
179 | public function jsonSerialize() |
||
183 | |||
184 | /** |
||
185 | * Request all results as array. |
||
186 | * |
||
187 | * @return array |
||
188 | */ |
||
189 | public function fetchAll(): array |
||
193 | } |
||
194 |