1 | <?php |
||
12 | class Index |
||
13 | { |
||
14 | /** |
||
15 | * @var string |
||
16 | */ |
||
17 | public const UNIQUE = 'unique'; |
||
18 | |||
19 | /** |
||
20 | * @var string |
||
21 | */ |
||
22 | public const INDEX = 'index'; |
||
23 | |||
24 | /** |
||
25 | * @var string |
||
26 | */ |
||
27 | public const FULLTEXT = 'fulltext'; |
||
28 | |||
29 | /** |
||
30 | * @var string[] |
||
31 | */ |
||
32 | protected $columns; |
||
33 | |||
34 | /** |
||
35 | * @var string |
||
36 | */ |
||
37 | protected $type = self::INDEX; |
||
38 | |||
39 | /** |
||
40 | * @var string|null |
||
41 | */ |
||
42 | protected $name; |
||
43 | |||
44 | /** |
||
45 | * @var int|array|null |
||
46 | */ |
||
47 | protected $limit; |
||
48 | |||
49 | /** |
||
50 | * @var string[] |
||
51 | */ |
||
52 | protected $order; |
||
53 | |||
54 | /** |
||
55 | * @var string[] |
||
56 | */ |
||
57 | protected $includedColumns; |
||
58 | |||
59 | /** |
||
60 | * Sets the index columns. |
||
61 | * |
||
62 | * @param string[] $columns Columns |
||
63 | * |
||
64 | * @return $this |
||
65 | */ |
||
66 | public function setColumns($columns) |
||
72 | |||
73 | /** |
||
74 | 30 | * Gets the index columns. |
|
75 | * |
||
76 | 30 | * @return string[] |
|
77 | 30 | */ |
|
78 | public function getColumns() |
||
82 | |||
83 | /** |
||
84 | * Sets the index type. |
||
85 | 30 | * |
|
86 | * @param string $type Type |
||
87 | 30 | * |
|
88 | * @return $this |
||
89 | */ |
||
90 | public function setType($type) |
||
96 | 12 | ||
97 | /** |
||
98 | 12 | * Gets the index type. |
|
99 | 12 | * |
|
100 | * @return string |
||
101 | */ |
||
102 | public function getType() |
||
106 | |||
107 | 32 | /** |
|
108 | * Sets the index name. |
||
109 | 32 | * |
|
110 | * @param string $name Name |
||
111 | * |
||
112 | * @return $this |
||
113 | */ |
||
114 | public function setName($name) |
||
120 | 10 | ||
121 | 10 | /** |
|
122 | * Gets the index name. |
||
123 | * |
||
124 | * @return string|null |
||
125 | */ |
||
126 | public function getName() |
||
130 | |||
131 | 30 | /** |
|
132 | * Sets the index limit. |
||
133 | * |
||
134 | * @param int|array $limit limit value or array of limit value |
||
135 | * |
||
136 | * @return $this |
||
137 | */ |
||
138 | public function setLimit($limit) |
||
144 | |||
145 | /** |
||
146 | * Gets the index limit. |
||
147 | * |
||
148 | * @return int|array |
||
149 | */ |
||
150 | public function getLimit() |
||
154 | |||
155 | /** |
||
156 | * Sets the index columns sort order. |
||
157 | * |
||
158 | * @param string[] $order column name sort order key value pair |
||
159 | * @return $this |
||
160 | */ |
||
161 | public function setOrder($order) |
||
167 | 29 | ||
168 | 20 | /** |
|
169 | 1 | * Gets the index columns sort order. |
|
170 | * |
||
171 | * @return string[] |
||
172 | */ |
||
173 | 19 | public function getOrder() |
|
177 | 9 | ||
178 | /** |
||
179 | * Sets the index included columns. |
||
180 | 12 | * |
|
181 | 12 | * @param string[] $includedColumns Columns |
|
182 | 28 | * @return $this |
|
183 | 28 | */ |
|
184 | public function setInclude($includedColumns) |
||
190 | |||
191 | /** |
||
192 | * Gets the index included columns. |
||
193 | * |
||
194 | * @return string[] |
||
195 | */ |
||
196 | public function getInclude() |
||
200 | |||
201 | /** |
||
202 | * Utility method that maps an array of index options to this objects methods. |
||
203 | * |
||
204 | * @param array $options Options |
||
205 | * |
||
206 | * @throws \RuntimeException |
||
207 | * |
||
208 | * @return $this |
||
209 | */ |
||
210 | public function setOptions($options) |
||
233 | } |
||
234 |