1 | <?php |
||
18 | class SelectContract extends Contract |
||
19 | { |
||
20 | |||
21 | /** |
||
22 | * A collection of columns for readable records. |
||
23 | * |
||
24 | * @var array |
||
25 | */ |
||
26 | private $columns = []; |
||
27 | |||
28 | /** |
||
29 | * Column filter. |
||
30 | * |
||
31 | * @var ColumnFilter |
||
32 | */ |
||
33 | private $filter = null; |
||
34 | |||
35 | /** |
||
36 | * Flag of selection of all columns. |
||
37 | * |
||
38 | * @var bool |
||
39 | */ |
||
40 | private $isAllColumns = false; |
||
41 | |||
42 | /** |
||
43 | * Flag of pagination. |
||
44 | * |
||
45 | * @var bool |
||
46 | */ |
||
47 | private $isPageable = false; |
||
48 | |||
49 | /** |
||
50 | * Flag of uniqueness. |
||
51 | * |
||
52 | * @var bool |
||
53 | */ |
||
54 | private $isDistinct = false; |
||
55 | |||
56 | /** |
||
57 | * Number of records selected. |
||
58 | * |
||
59 | * @var int |
||
60 | */ |
||
61 | private $rowCount = -1; |
||
62 | |||
63 | /** |
||
64 | * Sets the input values. |
||
65 | * |
||
66 | * @param string $rootSchemaName The name of the root schema object. |
||
67 | */ |
||
68 | 12 | public function __construct($rootSchemaName) |
|
76 | |||
77 | /** |
||
78 | * Sets the flag for selecting all columns. |
||
79 | * Returns the current object. |
||
80 | * |
||
81 | * @param bool $isAllColumns Flag of selection of all columns. |
||
82 | * |
||
83 | * @return self |
||
84 | */ |
||
85 | 1 | public function setIsAllColumns($isAllColumns) |
|
90 | |||
91 | /** |
||
92 | * Returns the flag for selecting all columns. |
||
93 | * |
||
94 | * @return bool |
||
95 | */ |
||
96 | 7 | private function isAllColumns() |
|
100 | |||
101 | /** |
||
102 | * Sets the pagination flag. |
||
103 | * Returns the current object. |
||
104 | * |
||
105 | * @param bool $isPageable Flag of pagination. |
||
106 | * |
||
107 | * @return self |
||
108 | */ |
||
109 | 1 | public function setIsPageable($isPageable) |
|
114 | |||
115 | /** |
||
116 | * Returns the pagination attribute. |
||
117 | * |
||
118 | * @return bool |
||
119 | */ |
||
120 | 7 | private function isPageable() |
|
124 | |||
125 | /** |
||
126 | * Sets flag of uniqueness. |
||
127 | * Returns the current object. |
||
128 | * |
||
129 | * @param bool $isDistinct Flag of uniqueness. |
||
130 | * |
||
131 | * @return self |
||
132 | */ |
||
133 | 1 | public function setIsDistinct($isDistinct) |
|
138 | |||
139 | /** |
||
140 | * Returns flag of uniqueness. |
||
141 | * |
||
142 | * @return bool |
||
143 | */ |
||
144 | 7 | private function isDistinct() |
|
148 | |||
149 | /** |
||
150 | * Sets number of records selected. |
||
151 | * Returns the current object. |
||
152 | * |
||
153 | * @param int $rowCount Number of records selected. |
||
154 | * |
||
155 | * @return self |
||
156 | */ |
||
157 | 1 | public function setRowCount($rowCount) |
|
162 | |||
163 | /** |
||
164 | * Return number of records selected. |
||
165 | * |
||
166 | * @return int |
||
167 | */ |
||
168 | 7 | private function getRowCount() |
|
172 | |||
173 | /** |
||
174 | * Adding a query expression to a contract. |
||
175 | * Returns the current object. |
||
176 | * |
||
177 | * @param string $name Column name. |
||
178 | * @param string $orderDirection The sort order. |
||
179 | * @param int $orderPosition Column position. |
||
180 | * @param string $caption Headline. |
||
181 | * @param ColumnExpression $columnExpression Query expression to the schema object. |
||
182 | * |
||
183 | * @return self |
||
184 | */ |
||
185 | 1 | public function addColumn($name, $orderDirection, $orderPosition, $caption, ColumnExpression $columnExpression) |
|
195 | |||
196 | /** |
||
197 | * Adding query filter to contract. |
||
198 | * |
||
199 | * @param ColumnFilter $columnFilter Column filter. |
||
200 | * |
||
201 | * @return self |
||
202 | */ |
||
203 | 1 | public function addFilter(ColumnFilter $columnFilter) |
|
208 | |||
209 | /** |
||
210 | * Returns data as an associative array. |
||
211 | * |
||
212 | * @return array |
||
213 | */ |
||
214 | 7 | public function toArray() |
|
254 | |||
255 | /** |
||
256 | * Validates contract data, throws an exception in case of an error. |
||
257 | */ |
||
258 | 2 | public function validate() |
|
264 | } |
||
265 |