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 | * Sets the index columns. |
||
56 | * |
||
57 | * @param string[] $columns Columns |
||
58 | * |
||
59 | * @return $this |
||
60 | */ |
||
61 | public function setColumns($columns) |
||
67 | |||
68 | /** |
||
69 | * Gets the index columns. |
||
70 | * |
||
71 | * @return string[] |
||
72 | */ |
||
73 | public function getColumns() |
||
77 | 30 | ||
78 | /** |
||
79 | * Sets the index type. |
||
80 | * |
||
81 | * @param string $type Type |
||
82 | * |
||
83 | * @return $this |
||
84 | */ |
||
85 | 30 | public function setType($type) |
|
91 | |||
92 | /** |
||
93 | * Gets the index type. |
||
94 | * |
||
95 | * @return string |
||
96 | 12 | */ |
|
97 | public function getType() |
||
101 | |||
102 | /** |
||
103 | * Sets the index name. |
||
104 | * |
||
105 | * @param string $name Name |
||
106 | * |
||
107 | 32 | * @return $this |
|
108 | */ |
||
109 | 32 | public function setName($name) |
|
115 | |||
116 | /** |
||
117 | * Gets the index name. |
||
118 | 10 | * |
|
119 | * @return string|null |
||
120 | 10 | */ |
|
121 | 10 | public function getName() |
|
125 | |||
126 | /** |
||
127 | * Sets the index limit. |
||
128 | * |
||
129 | 30 | * @param int|array $limit limit value or array of limit value |
|
130 | * |
||
131 | 30 | * @return $this |
|
132 | */ |
||
133 | public function setLimit($limit) |
||
139 | |||
140 | 1 | /** |
|
141 | * Gets the index limit. |
||
142 | 1 | * |
|
143 | 1 | * @return int|array |
|
144 | */ |
||
145 | public function getLimit() |
||
149 | |||
150 | /** |
||
151 | 15 | * Sets the index columns sort order. |
|
152 | * |
||
153 | 15 | * @param string[] $order column name sort order key value pair |
|
154 | * @return $this |
||
155 | */ |
||
156 | public function setOrder($order) |
||
162 | |||
163 | 29 | /** |
|
164 | * Gets the index columns sort order. |
||
165 | * |
||
166 | 29 | * @return string[] |
|
167 | 29 | */ |
|
168 | 20 | public function getOrder() |
|
172 | |||
173 | 19 | /** |
|
174 | 9 | * Utility method that maps an array of index options to this objects methods. |
|
175 | 9 | * |
|
176 | 9 | * @param array $options Options |
|
177 | 9 | * |
|
178 | * @throws \RuntimeException |
||
179 | * |
||
180 | 12 | * @return $this |
|
181 | 12 | */ |
|
182 | 28 | public function setOptions($options) |
|
205 | } |
||
206 |