1 | <?php |
||
13 | class Column |
||
14 | { |
||
15 | /** |
||
16 | * @var boolean |
||
17 | */ |
||
18 | protected $autoIncrement = false; |
||
19 | |||
20 | /** |
||
21 | * @var string |
||
22 | */ |
||
23 | protected $dataType = ''; |
||
24 | |||
25 | /** |
||
26 | * @var string |
||
27 | */ |
||
28 | protected $defaultValue = ''; |
||
29 | |||
30 | /** |
||
31 | * @var string |
||
32 | */ |
||
33 | protected $field = ''; |
||
34 | |||
35 | /** |
||
36 | * @var boolean |
||
37 | */ |
||
38 | protected $foreign = false; |
||
39 | |||
40 | /** |
||
41 | * @var integer |
||
42 | */ |
||
43 | protected $length = 0; |
||
44 | |||
45 | /** |
||
46 | * @var boolean |
||
47 | */ |
||
48 | protected $null = false; |
||
49 | |||
50 | /** |
||
51 | * @var boolean |
||
52 | */ |
||
53 | protected $primary = false; |
||
54 | |||
55 | /** |
||
56 | * @var string |
||
57 | */ |
||
58 | protected $referencedField = ''; |
||
59 | |||
60 | /** |
||
61 | * @var string |
||
62 | */ |
||
63 | protected $referencedTable = ''; |
||
64 | |||
65 | /** |
||
66 | * @var boolean |
||
67 | */ |
||
68 | protected $unique = false; |
||
69 | |||
70 | /** |
||
71 | * @var boolean |
||
72 | */ |
||
73 | protected $unsigned = false; |
||
74 | |||
75 | /** |
||
76 | * Gets the data type. |
||
77 | * |
||
78 | * @return string |
||
79 | */ |
||
80 | 3 | public function getDataType() |
|
81 | { |
||
82 | 3 | return $this->dataType; |
|
83 | } |
||
84 | |||
85 | /** |
||
86 | * Gets the default value. |
||
87 | * |
||
88 | * @return string |
||
89 | */ |
||
90 | 3 | public function getDefaultValue() |
|
91 | { |
||
92 | 3 | return $this->defaultValue; |
|
93 | } |
||
94 | |||
95 | /** |
||
96 | * Gets the column description. |
||
97 | * |
||
98 | * @return string |
||
99 | */ |
||
100 | 18 | public function getField() |
|
104 | |||
105 | /** |
||
106 | * Gets the foreign field. |
||
107 | * |
||
108 | * @return string |
||
109 | */ |
||
110 | 3 | public function getReferencedField() |
|
114 | |||
115 | /** |
||
116 | * Gets the foreign table. |
||
117 | * |
||
118 | * @return string |
||
119 | */ |
||
120 | 3 | public function getReferencedTable() |
|
124 | |||
125 | /** |
||
126 | * Gets the field's length. |
||
127 | * |
||
128 | * @return integer |
||
129 | */ |
||
130 | 3 | public function getLength() |
|
134 | |||
135 | /** |
||
136 | * Check if the field is an auto incrementing field. |
||
137 | * |
||
138 | * @return boolean |
||
139 | */ |
||
140 | 3 | public function isAutoIncrement() |
|
144 | |||
145 | /** |
||
146 | * Check if the field is a foreign key. |
||
147 | * |
||
148 | * @return boolean |
||
149 | */ |
||
150 | 3 | public function isForeignKey() |
|
154 | |||
155 | /** |
||
156 | * Check if the field accept NULL values. |
||
157 | * |
||
158 | * @return boolean |
||
159 | */ |
||
160 | 3 | public function isNull() |
|
164 | |||
165 | /** |
||
166 | * Check if the field is a primary key. |
||
167 | * |
||
168 | * @return boolean |
||
169 | */ |
||
170 | 18 | public function isPrimaryKey() |
|
174 | |||
175 | /** |
||
176 | * Check if field is unique. |
||
177 | * |
||
178 | * @return boolean |
||
179 | */ |
||
180 | 3 | public function isUnique() |
|
184 | |||
185 | /** |
||
186 | * Check if field is unsigned. |
||
187 | * |
||
188 | * @return boolean |
||
189 | */ |
||
190 | 3 | public function isUnsigned() |
|
194 | |||
195 | /** |
||
196 | * Sets the auto increment. |
||
197 | * |
||
198 | * @param boolean $autoIncrement |
||
199 | */ |
||
200 | 60 | public function setAutoIncrement($autoIncrement) |
|
206 | |||
207 | /** |
||
208 | * Sets the data type. |
||
209 | * |
||
210 | * @param string $dataType |
||
211 | */ |
||
212 | 60 | public function setDataType($dataType) |
|
221 | |||
222 | /** |
||
223 | * Sets the default value. |
||
224 | * |
||
225 | * @param string $defaultValue |
||
226 | */ |
||
227 | 60 | public function setDefaultValue($defaultValue) |
|
233 | |||
234 | /** |
||
235 | * Sets the column's description. |
||
236 | * |
||
237 | * @param string $field |
||
238 | */ |
||
239 | 60 | public function setField($field) |
|
245 | |||
246 | /** |
||
247 | * Sets the field as a foreign key. |
||
248 | * |
||
249 | * @param boolean $foreign |
||
250 | */ |
||
251 | 60 | public function setForeign($foreign) |
|
257 | |||
258 | /** |
||
259 | * Sets the foreign field. |
||
260 | * |
||
261 | * @param string $referencedField |
||
262 | */ |
||
263 | 57 | public function setReferencedField($referencedField) |
|
269 | |||
270 | /** |
||
271 | * Sets the foreign table. |
||
272 | * |
||
273 | * @param string $foreignTable |
||
274 | */ |
||
275 | 57 | public function setReferencedTable($foreignTable) |
|
281 | |||
282 | /** |
||
283 | * Sets the field's length. |
||
284 | * |
||
285 | * @param integer $length |
||
286 | */ |
||
287 | 48 | public function setLength($length) |
|
293 | |||
294 | /** |
||
295 | * Sets if field accepts NULL values. |
||
296 | * |
||
297 | * @param boolean $null |
||
298 | */ |
||
299 | 60 | public function setNull($null = true) |
|
305 | |||
306 | /** |
||
307 | * Sets if field is a primary key. |
||
308 | * |
||
309 | * @param boolean $primary |
||
310 | */ |
||
311 | 60 | public function setPrimary($primary = true) |
|
317 | |||
318 | /** |
||
319 | * Sets if field is a unique key. |
||
320 | * |
||
321 | * @param boolean $unique |
||
322 | */ |
||
323 | 48 | public function setUnique($unique = true) |
|
329 | |||
330 | /** |
||
331 | * Sets if field is an unsigned key. |
||
332 | * |
||
333 | * @param boolean $unsigned |
||
334 | */ |
||
335 | 3 | public function setUnsigned($unsigned = true) |
|
341 | |||
342 | /** |
||
343 | * Calls methods from this class in underscore case. |
||
344 | * |
||
345 | * @param string $method |
||
346 | * @param mixed $parameters |
||
347 | * @return mixed |
||
348 | */ |
||
349 | 3 | public function __call($method, $parameters) |
|
353 | } |
||
354 |