1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace EventEspresso\core\services\orm; |
4
|
|
|
|
5
|
|
|
use EE_All_Caps_Text_Field; |
6
|
|
|
use EE_Any_Foreign_Model_Name_Field; |
7
|
|
|
use EE_Boolean_Field; |
8
|
|
|
use EE_Datetime_Field; |
9
|
|
|
use EE_DB_Only_Float_Field; |
10
|
|
|
use EE_DB_Only_Int_Field; |
11
|
|
|
use EE_DB_Only_Text_Field; |
12
|
|
|
use EE_Email_Field; |
13
|
|
|
use EE_Enum_Integer_Field; |
14
|
|
|
use EE_Enum_Text_Field; |
15
|
|
|
use EE_Error; |
16
|
|
|
use EE_Float_Field; |
17
|
|
|
use EE_Foreign_Key_Int_Field; |
18
|
|
|
use EE_Foreign_Key_String_Field; |
19
|
|
|
use EE_Full_HTML_Field; |
20
|
|
|
use EE_Infinite_Integer_Field; |
21
|
|
|
use EE_Integer_Field; |
22
|
|
|
use EE_Maybe_Serialized_Simple_HTML_Field; |
23
|
|
|
use EE_Maybe_Serialized_Text_Field; |
24
|
|
|
use EE_Money_Field; |
25
|
|
|
use EE_Plain_Text_Field; |
26
|
|
|
use EE_Post_Content_Field; |
27
|
|
|
use EE_Primary_Key_Int_Field; |
28
|
|
|
use EE_Primary_Key_String_Field; |
29
|
|
|
use EE_Serialized_Text_Field; |
30
|
|
|
use EE_Simple_HTML_Field; |
31
|
|
|
use EE_Slug_Field; |
32
|
|
|
use EE_Trashed_Flag_Field; |
33
|
|
|
use EE_WP_Post_Status_Field; |
34
|
|
|
use EE_WP_Post_Type_Field; |
35
|
|
|
use EE_WP_User_Field; |
36
|
|
|
use EventEspresso\core\exceptions\InvalidDataTypeException; |
37
|
|
|
use EventEspresso\core\exceptions\InvalidInterfaceException; |
38
|
|
|
use EventEspresso\core\services\loaders\LoaderFactory; |
39
|
|
|
use EventEspresso\core\services\loaders\LoaderInterface; |
40
|
|
|
use InvalidArgumentException; |
41
|
|
|
|
42
|
|
|
defined('EVENT_ESPRESSO_VERSION') || exit; |
43
|
|
|
|
44
|
|
|
|
45
|
|
|
/** |
46
|
|
|
* Class ModelFieldFactory |
47
|
|
|
* Factory class for generating Model Field objects |
48
|
|
|
* |
49
|
|
|
* @package EventEspresso\core\services\database |
50
|
|
|
* @author Brent Christensen |
51
|
|
|
* @since 4.9.45 |
52
|
|
|
*/ |
53
|
|
|
class ModelFieldFactory |
54
|
|
|
{ |
55
|
|
|
|
56
|
|
|
/** |
57
|
|
|
* @var LoaderInterface $loader |
58
|
|
|
*/ |
59
|
|
|
private $loader; |
60
|
|
|
|
61
|
|
|
|
62
|
|
|
|
63
|
|
|
/** |
64
|
|
|
* ModelFieldFactory constructor. |
65
|
|
|
* |
66
|
|
|
* @param LoaderInterface $loader |
67
|
|
|
*/ |
68
|
|
|
public function __construct(LoaderInterface $loader) |
69
|
|
|
{ |
70
|
|
|
$this->loader = $loader; |
71
|
|
|
} |
72
|
|
|
|
73
|
|
|
|
74
|
|
|
|
75
|
|
|
/** |
76
|
|
|
* @param string $table_column |
77
|
|
|
* @param string $nice_name |
78
|
|
|
* @param bool $nullable |
79
|
|
|
* @param null $default_value |
80
|
|
|
* @return EE_All_Caps_Text_Field |
81
|
|
|
*/ |
82
|
|
View Code Duplication |
public function createAllCapsTextField($table_column, $nice_name, $nullable, $default_value = null) |
83
|
|
|
{ |
84
|
|
|
return $this->loader->getNew( |
85
|
|
|
'EE_All_Caps_Text_Field', |
86
|
|
|
array($table_column, $nice_name, $nullable, $default_value) |
87
|
|
|
); |
88
|
|
|
} |
89
|
|
|
|
90
|
|
|
|
91
|
|
|
|
92
|
|
|
/** |
93
|
|
|
* @param string $table_column |
94
|
|
|
* @param string $nice_name |
95
|
|
|
* @param bool $nullable |
96
|
|
|
* @param null $default_value |
97
|
|
|
* @param string $model_name |
98
|
|
|
* @return EE_Any_Foreign_Model_Name_Field |
99
|
|
|
*/ |
100
|
|
View Code Duplication |
public function createAnyForeignModelNameField( |
101
|
|
|
$table_column, |
102
|
|
|
$nice_name, |
103
|
|
|
$nullable, |
104
|
|
|
$default_value = null, |
105
|
|
|
$model_name |
106
|
|
|
) { |
107
|
|
|
return $this->loader->getNew( |
108
|
|
|
'EE_Any_Foreign_Model_Name_Field', |
109
|
|
|
array($table_column, $nice_name, $nullable, $default_value, $model_name) |
110
|
|
|
); |
111
|
|
|
} |
112
|
|
|
|
113
|
|
|
|
114
|
|
|
|
115
|
|
|
/** |
116
|
|
|
* @param string $table_column |
117
|
|
|
* @param string $nice_name |
118
|
|
|
* @param bool $nullable |
119
|
|
|
* @param null $default_value |
120
|
|
|
* @return EE_Boolean_Field |
121
|
|
|
*/ |
122
|
|
View Code Duplication |
public function createBooleanField($table_column, $nice_name, $nullable, $default_value = null) |
123
|
|
|
{ |
124
|
|
|
return $this->loader->getNew( |
125
|
|
|
'EE_Boolean_Field', |
126
|
|
|
array($table_column, $nice_name, $nullable, $default_value) |
127
|
|
|
); |
128
|
|
|
} |
129
|
|
|
|
130
|
|
|
|
131
|
|
|
|
132
|
|
|
/** |
133
|
|
|
* @param string $table_column |
134
|
|
|
* @param string $nice_name |
135
|
|
|
* @param string $timezone_string |
|
|
|
|
136
|
|
|
* @param bool $nullable |
137
|
|
|
* @param string $default_value |
138
|
|
|
* @throws EE_Error |
139
|
|
|
* @throws InvalidArgumentException |
140
|
|
|
* @return EE_Datetime_Field |
141
|
|
|
*/ |
142
|
|
View Code Duplication |
public function createDatetimeField( |
143
|
|
|
$table_column, |
144
|
|
|
$nice_name, |
145
|
|
|
$nullable = false, |
146
|
|
|
$default_value = EE_Datetime_Field::now |
147
|
|
|
) { |
148
|
|
|
return $this->loader->getNew( |
149
|
|
|
'EE_Datetime_Field', |
150
|
|
|
array( |
151
|
|
|
$table_column, |
152
|
|
|
$nice_name, |
153
|
|
|
$nullable, |
154
|
|
|
$default_value |
155
|
|
|
) |
156
|
|
|
); |
157
|
|
|
} |
158
|
|
|
|
159
|
|
|
|
160
|
|
|
|
161
|
|
|
/** |
162
|
|
|
* @param string $table_column |
163
|
|
|
* @param string $nice_name |
164
|
|
|
* @param bool $nullable |
165
|
|
|
* @param null $default_value |
166
|
|
|
* @return EE_DB_Only_Float_Field |
167
|
|
|
*/ |
168
|
|
View Code Duplication |
public function createDbOnlyFloatField($table_column, $nice_name, $nullable, $default_value = null) |
169
|
|
|
{ |
170
|
|
|
return $this->loader->getNew( |
171
|
|
|
'EE_DB_Only_Float_Field', |
172
|
|
|
array($table_column, $nice_name, $nullable, $default_value) |
173
|
|
|
); |
174
|
|
|
} |
175
|
|
|
|
176
|
|
|
|
177
|
|
|
|
178
|
|
|
/** |
179
|
|
|
* @param string $table_column |
180
|
|
|
* @param string $nice_name |
181
|
|
|
* @param bool $nullable |
182
|
|
|
* @param null $default_value |
183
|
|
|
* @return EE_DB_Only_Int_Field |
184
|
|
|
*/ |
185
|
|
View Code Duplication |
public function createDbOnlyIntField($table_column, $nice_name, $nullable, $default_value = null) |
186
|
|
|
{ |
187
|
|
|
return $this->loader->getNew( |
188
|
|
|
'EE_DB_Only_Int_Field', |
189
|
|
|
array($table_column, $nice_name, $nullable, $default_value) |
190
|
|
|
); |
191
|
|
|
} |
192
|
|
|
|
193
|
|
|
|
194
|
|
|
|
195
|
|
|
/** |
196
|
|
|
* @param string $table_column |
197
|
|
|
* @param string $nice_name |
198
|
|
|
* @param bool $nullable |
199
|
|
|
* @param null $default_value |
200
|
|
|
* @return EE_DB_Only_Text_Field |
201
|
|
|
*/ |
202
|
|
View Code Duplication |
public function createDbOnlyTextField($table_column, $nice_name, $nullable, $default_value = null) |
203
|
|
|
{ |
204
|
|
|
return $this->loader->getNew( |
205
|
|
|
'EE_DB_Only_Text_Field', |
206
|
|
|
array($table_column, $nice_name, $nullable, $default_value) |
207
|
|
|
); |
208
|
|
|
} |
209
|
|
|
|
210
|
|
|
|
211
|
|
|
|
212
|
|
|
/** |
213
|
|
|
* @param string $table_column |
214
|
|
|
* @param string $nice_name |
215
|
|
|
* @param bool $nullable |
216
|
|
|
* @param string $default_value |
217
|
|
|
* @return EE_Email_Field |
218
|
|
|
*/ |
219
|
|
View Code Duplication |
public function createEmailField($table_column, $nice_name, $nullable = true, $default_value = '') |
220
|
|
|
{ |
221
|
|
|
return $this->loader->getNew( |
222
|
|
|
'EE_Email_Field', |
223
|
|
|
array($table_column, $nice_name, $nullable, $default_value) |
224
|
|
|
); |
225
|
|
|
} |
226
|
|
|
|
227
|
|
|
|
228
|
|
|
|
229
|
|
|
/** |
230
|
|
|
* @param string $table_column |
231
|
|
|
* @param string $nice_name |
232
|
|
|
* @param bool $nullable |
233
|
|
|
* @param null $default_value |
234
|
|
|
* @param array $allowed_enum_values keys are values to be used in the DB, |
235
|
|
|
* values are how they should be displayed |
236
|
|
|
* @return EE_Enum_Integer_Field |
237
|
|
|
*/ |
238
|
|
View Code Duplication |
public function createEnumIntegerField( |
239
|
|
|
$table_column, |
240
|
|
|
$nice_name, |
241
|
|
|
$nullable, |
242
|
|
|
$default_value = null, |
243
|
|
|
array $allowed_enum_values |
244
|
|
|
) { |
245
|
|
|
return $this->loader->getNew( |
246
|
|
|
'EE_Enum_Integer_Field', |
247
|
|
|
array($table_column, $nice_name, $nullable, $default_value, $allowed_enum_values) |
248
|
|
|
); |
249
|
|
|
} |
250
|
|
|
|
251
|
|
|
|
252
|
|
|
|
253
|
|
|
/** |
254
|
|
|
* @param string $table_column |
255
|
|
|
* @param string $nice_name |
256
|
|
|
* @param bool $nullable |
257
|
|
|
* @param null $default_value |
258
|
|
|
* @param array $allowed_enum_values keys are values to be used in the DB, |
259
|
|
|
* values are how they should be displayed |
260
|
|
|
* @return EE_Enum_Text_Field |
261
|
|
|
*/ |
262
|
|
View Code Duplication |
public function createEnumTextField( |
263
|
|
|
$table_column, |
264
|
|
|
$nice_name, |
265
|
|
|
$nullable, |
266
|
|
|
$default_value, |
267
|
|
|
array $allowed_enum_values |
268
|
|
|
) { |
269
|
|
|
return $this->loader->getNew( |
270
|
|
|
'EE_Enum_Text_Field', |
271
|
|
|
array($table_column, $nice_name, $nullable, $default_value, $allowed_enum_values) |
272
|
|
|
); |
273
|
|
|
} |
274
|
|
|
|
275
|
|
|
|
276
|
|
|
|
277
|
|
|
/** |
278
|
|
|
* @param string $table_column |
279
|
|
|
* @param string $nice_name |
280
|
|
|
* @param bool $nullable |
281
|
|
|
* @param null $default_value |
282
|
|
|
* @return EE_Float_Field |
283
|
|
|
*/ |
284
|
|
View Code Duplication |
public function createFloatField($table_column, $nice_name, $nullable, $default_value = null) |
285
|
|
|
{ |
286
|
|
|
return $this->loader->getNew( |
287
|
|
|
'EE_Float_Field', |
288
|
|
|
array($table_column, $nice_name, $nullable, $default_value) |
289
|
|
|
); |
290
|
|
|
} |
291
|
|
|
|
292
|
|
|
|
293
|
|
|
|
294
|
|
|
/** |
295
|
|
|
* @param string $table_column |
296
|
|
|
* @param string $nice_name |
297
|
|
|
* @param bool $nullable |
298
|
|
|
* @param null $default_value |
299
|
|
|
* @param string $model_name |
300
|
|
|
* @return EE_Foreign_Key_Int_Field |
301
|
|
|
*/ |
302
|
|
View Code Duplication |
public function createForeignKeyIntField($table_column, $nice_name, $nullable, $default_value, $model_name) |
303
|
|
|
{ |
304
|
|
|
return $this->loader->getNew( |
305
|
|
|
'EE_Foreign_Key_Int_Field', |
306
|
|
|
array($table_column, $nice_name, $nullable, $default_value, $model_name) |
307
|
|
|
); |
308
|
|
|
} |
309
|
|
|
|
310
|
|
|
|
311
|
|
|
|
312
|
|
|
/** |
313
|
|
|
* @param string $table_column |
314
|
|
|
* @param string $nice_name |
315
|
|
|
* @param bool $nullable |
316
|
|
|
* @param null $default_value |
317
|
|
|
* @param string $model_name |
318
|
|
|
* @return EE_Foreign_Key_String_Field |
319
|
|
|
*/ |
320
|
|
View Code Duplication |
public function createForeignKeyStringField( |
321
|
|
|
$table_column, |
322
|
|
|
$nice_name, |
323
|
|
|
$nullable, |
324
|
|
|
$default_value, |
325
|
|
|
$model_name |
326
|
|
|
) { |
327
|
|
|
return $this->loader->getNew( |
328
|
|
|
'EE_Foreign_Key_String_Field', |
329
|
|
|
array($table_column, $nice_name, $nullable, $default_value, $model_name) |
330
|
|
|
); |
331
|
|
|
} |
332
|
|
|
|
333
|
|
|
|
334
|
|
|
|
335
|
|
|
/** |
336
|
|
|
* @param string $table_column |
337
|
|
|
* @param string $nice_name |
338
|
|
|
* @param bool $nullable |
339
|
|
|
* @param null $default_value |
340
|
|
|
* @return EE_Full_HTML_Field |
341
|
|
|
*/ |
342
|
|
View Code Duplication |
public function createFullHtmlField($table_column, $nice_name, $nullable, $default_value = null) |
343
|
|
|
{ |
344
|
|
|
return $this->loader->getNew( |
345
|
|
|
'EE_Full_HTML_Field', |
346
|
|
|
array($table_column, $nice_name, $nullable, $default_value) |
347
|
|
|
); |
348
|
|
|
} |
349
|
|
|
|
350
|
|
|
|
351
|
|
|
|
352
|
|
|
/** |
353
|
|
|
* @param string $table_column |
354
|
|
|
* @param string $nice_name |
355
|
|
|
* @param bool $nullable |
356
|
|
|
* @param null $default_value |
357
|
|
|
* @return EE_Infinite_Integer_Field |
358
|
|
|
*/ |
359
|
|
View Code Duplication |
public function createInfiniteIntegerField($table_column, $nice_name, $nullable, $default_value = null) |
360
|
|
|
{ |
361
|
|
|
return $this->loader->getNew( |
362
|
|
|
'EE_Infinite_Integer_Field', |
363
|
|
|
array($table_column, $nice_name, $nullable, $default_value) |
364
|
|
|
); |
365
|
|
|
} |
366
|
|
|
|
367
|
|
|
|
368
|
|
|
|
369
|
|
|
/** |
370
|
|
|
* @param string $table_column |
371
|
|
|
* @param string $nice_name |
372
|
|
|
* @param bool $nullable |
373
|
|
|
* @param integer $default_value |
374
|
|
|
* @return EE_Integer_Field |
375
|
|
|
*/ |
376
|
|
View Code Duplication |
public function createIntegerField($table_column, $nice_name, $nullable = false, $default_value = 0) |
377
|
|
|
{ |
378
|
|
|
return $this->loader->getNew( |
379
|
|
|
'EE_Integer_Field', |
380
|
|
|
array($table_column, $nice_name, $nullable, $default_value) |
381
|
|
|
); |
382
|
|
|
} |
383
|
|
|
|
384
|
|
|
|
385
|
|
|
|
386
|
|
|
/** |
387
|
|
|
* @param string $table_column |
388
|
|
|
* @param string $nice_name |
389
|
|
|
* @param bool $nullable |
390
|
|
|
* @param null $default_value |
391
|
|
|
* @return EE_Maybe_Serialized_Simple_HTML_Field |
392
|
|
|
*/ |
393
|
|
View Code Duplication |
public function createMaybeSerializedSimpleHtmlField($table_column, $nice_name, $nullable, $default_value = null) |
394
|
|
|
{ |
395
|
|
|
return $this->loader->getNew( |
396
|
|
|
'EE_Maybe_Serialized_Simple_HTML_Field', |
397
|
|
|
array($table_column, $nice_name, $nullable, $default_value) |
398
|
|
|
); |
399
|
|
|
} |
400
|
|
|
|
401
|
|
|
|
402
|
|
|
|
403
|
|
|
/** |
404
|
|
|
* @param string $table_column |
405
|
|
|
* @param string $nice_name |
406
|
|
|
* @param bool $nullable |
407
|
|
|
* @param null $default_value |
408
|
|
|
* @return EE_Maybe_Serialized_Text_Field |
409
|
|
|
*/ |
410
|
|
View Code Duplication |
public function createMaybeSerializedTextField($table_column, $nice_name, $nullable, $default_value = null) |
411
|
|
|
{ |
412
|
|
|
return $this->loader->getNew( |
413
|
|
|
'EE_Maybe_Serialized_Text_Field', |
414
|
|
|
array($table_column, $nice_name, $nullable, $default_value) |
415
|
|
|
); |
416
|
|
|
} |
417
|
|
|
|
418
|
|
|
|
419
|
|
|
|
420
|
|
|
/** |
421
|
|
|
* @param string $table_column |
422
|
|
|
* @param string $nice_name |
423
|
|
|
* @param bool $nullable |
424
|
|
|
* @param null $default_value |
425
|
|
|
* @return EE_Money_Field |
426
|
|
|
*/ |
427
|
|
View Code Duplication |
public function createMoneyField($table_column, $nice_name, $nullable, $default_value = null) |
428
|
|
|
{ |
429
|
|
|
return $this->loader->getNew( |
430
|
|
|
'EE_Money_Field', |
431
|
|
|
array($table_column, $nice_name, $nullable, $default_value) |
432
|
|
|
); |
433
|
|
|
} |
434
|
|
|
|
435
|
|
|
|
436
|
|
|
|
437
|
|
|
/** |
438
|
|
|
* @param string $table_column |
439
|
|
|
* @param string $nice_name |
440
|
|
|
* @param bool $nullable |
441
|
|
|
* @param string $default_value |
442
|
|
|
* @return EE_Plain_Text_Field |
443
|
|
|
*/ |
444
|
|
View Code Duplication |
public function createPlainTextField($table_column, $nice_name, $nullable = true, $default_value = '') |
445
|
|
|
{ |
446
|
|
|
return $this->loader->getNew( |
447
|
|
|
'EE_Plain_Text_Field', |
448
|
|
|
array($table_column, $nice_name, $nullable, $default_value) |
449
|
|
|
); |
450
|
|
|
} |
451
|
|
|
|
452
|
|
|
|
453
|
|
|
|
454
|
|
|
/** |
455
|
|
|
* @param string $table_column |
456
|
|
|
* @param string $nice_name |
457
|
|
|
* @param bool $nullable |
458
|
|
|
* @param null $default_value |
459
|
|
|
* @return EE_Post_Content_Field |
460
|
|
|
*/ |
461
|
|
View Code Duplication |
public function createPostContentField($table_column, $nice_name, $nullable, $default_value = null) |
462
|
|
|
{ |
463
|
|
|
return $this->loader->getNew( |
464
|
|
|
'EE_Post_Content_Field', |
465
|
|
|
array($table_column, $nice_name, $nullable, $default_value) |
466
|
|
|
); |
467
|
|
|
} |
468
|
|
|
|
469
|
|
|
|
470
|
|
|
|
471
|
|
|
/** |
472
|
|
|
* @param string $table_column |
473
|
|
|
* @param string $nice_name |
474
|
|
|
* @return EE_Primary_Key_Int_Field |
475
|
|
|
*/ |
476
|
|
|
public function createPrimaryKeyIntField($table_column, $nice_name) |
477
|
|
|
{ |
478
|
|
|
return $this->loader->getNew('EE_Primary_Key_Int_Field', array($table_column, $nice_name)); |
479
|
|
|
} |
480
|
|
|
|
481
|
|
|
|
482
|
|
|
|
483
|
|
|
/** |
484
|
|
|
* @param string $table_column |
485
|
|
|
* @param string $nice_name |
486
|
|
|
* @return EE_Primary_Key_String_Field |
487
|
|
|
*/ |
488
|
|
|
public function createPrimaryKeyStringField($table_column, $nice_name) |
489
|
|
|
{ |
490
|
|
|
return $this->loader->getNew('EE_Primary_Key_String_Field', array($table_column, $nice_name)); |
491
|
|
|
} |
492
|
|
|
|
493
|
|
|
|
494
|
|
|
|
495
|
|
|
/** |
496
|
|
|
* @param string $table_column |
497
|
|
|
* @param string $nice_name |
498
|
|
|
* @param bool $nullable |
499
|
|
|
* @param null $default_value |
500
|
|
|
* @return EE_Serialized_Text_Field |
501
|
|
|
*/ |
502
|
|
View Code Duplication |
public function createSerializedTextField($table_column, $nice_name, $nullable, $default_value = null) |
503
|
|
|
{ |
504
|
|
|
return $this->loader->getNew( |
505
|
|
|
'EE_Serialized_Text_Field', |
506
|
|
|
array($table_column, $nice_name, $nullable, $default_value) |
507
|
|
|
); |
508
|
|
|
} |
509
|
|
|
|
510
|
|
|
|
511
|
|
|
|
512
|
|
|
/** |
513
|
|
|
* @param string $table_column |
514
|
|
|
* @param string $nice_name |
515
|
|
|
* @param bool $nullable |
516
|
|
|
* @param null $default_value |
517
|
|
|
* @return EE_Simple_HTML_Field |
518
|
|
|
*/ |
519
|
|
View Code Duplication |
public function createSimpleHtmlField($table_column, $nice_name, $nullable, $default_value = null) |
520
|
|
|
{ |
521
|
|
|
return $this->loader->getNew( |
522
|
|
|
'EE_Simple_HTML_Field', |
523
|
|
|
array($table_column, $nice_name, $nullable, $default_value) |
524
|
|
|
); |
525
|
|
|
} |
526
|
|
|
|
527
|
|
|
|
528
|
|
|
|
529
|
|
|
/** |
530
|
|
|
* @param string $table_column |
531
|
|
|
* @param string $nice_name |
532
|
|
|
* @param bool $nullable |
533
|
|
|
* @param null $default_value |
534
|
|
|
* @return EE_Slug_Field |
535
|
|
|
*/ |
536
|
|
View Code Duplication |
public function createSlugField($table_column, $nice_name, $nullable = false, $default_value = null) |
537
|
|
|
{ |
538
|
|
|
return $this->loader->getNew( |
539
|
|
|
'EE_Slug_Field', |
540
|
|
|
array($table_column, $nice_name, $nullable, $default_value) |
541
|
|
|
); |
542
|
|
|
} |
543
|
|
|
|
544
|
|
|
|
545
|
|
|
|
546
|
|
|
/** |
547
|
|
|
* @param string $table_column |
548
|
|
|
* @param string $nice_name |
549
|
|
|
* @param bool $nullable |
550
|
|
|
* @param null $default_value |
551
|
|
|
* @return EE_Trashed_Flag_Field |
552
|
|
|
*/ |
553
|
|
View Code Duplication |
public function createTrashedFlagField($table_column, $nice_name, $nullable, $default_value = null) |
554
|
|
|
{ |
555
|
|
|
return $this->loader->getNew( |
556
|
|
|
'EE_Trashed_Flag_Field', |
557
|
|
|
array($table_column, $nice_name, $nullable, $default_value) |
558
|
|
|
); |
559
|
|
|
} |
560
|
|
|
|
561
|
|
|
|
562
|
|
|
|
563
|
|
|
/** |
564
|
|
|
* @param string $table_column |
565
|
|
|
* @param string $nice_name |
566
|
|
|
* @param bool $nullable |
567
|
|
|
* @param mixed $default_value |
568
|
|
|
* @param array $values If additional stati are to be used other than the default WP statuses, |
569
|
|
|
* then they can be registered via this property. |
570
|
|
|
* The format of the array should be as follows: |
571
|
|
|
* array( |
572
|
|
|
* 'status_reference' => array( |
573
|
|
|
* 'label' => __('Status Reference Label', 'event_espresso'), |
574
|
|
|
* 'public' => true, // whether this status should be shown on the frontend of the site |
575
|
|
|
* 'exclude_from_search' => false, // whether this status should be excluded from wp searches |
576
|
|
|
* 'show_in_admin_all_list' => true, // whether this status is included in queries |
577
|
|
|
* for the admin "all" view in list table views. |
578
|
|
|
* 'show_in_admin_status_list' => true, // show in the list of statuses with post counts at the top |
579
|
|
|
* of the admin list tables (i.e. Status Reference(2) ) |
580
|
|
|
* 'label_count' => _n_noop( |
581
|
|
|
* 'Status Reference <span class="count">(%s)</span>', |
582
|
|
|
* 'Status References <span class="count">(%s)</span>' |
583
|
|
|
* ), // the text to display on the admin screen |
584
|
|
|
* ( or you won't see your status count ). |
585
|
|
|
* ) |
586
|
|
|
* ) |
587
|
|
|
* @link http://codex.wordpress.org/Function_Reference/register_post_status for more info |
588
|
|
|
* @return EE_WP_Post_Status_Field |
589
|
|
|
*/ |
590
|
|
View Code Duplication |
public function createWpPostStatusField( |
591
|
|
|
$table_column, |
592
|
|
|
$nice_name, |
593
|
|
|
$nullable, |
594
|
|
|
$default_value = null, |
595
|
|
|
array $values = array() |
596
|
|
|
) { |
597
|
|
|
return $this->loader->getNew( |
598
|
|
|
'EE_WP_Post_Status_Field', |
599
|
|
|
array($table_column, $nice_name, $nullable, $default_value, $values) |
600
|
|
|
); |
601
|
|
|
} |
602
|
|
|
|
603
|
|
|
|
604
|
|
|
|
605
|
|
|
/** |
606
|
|
|
* @param string $post_type |
607
|
|
|
* @return EE_WP_Post_Type_Field |
608
|
|
|
*/ |
609
|
|
|
public function createWpPostTypeField($post_type) |
610
|
|
|
{ |
611
|
|
|
return $this->loader->getNew('EE_WP_Post_Type_Field', array($post_type)); |
612
|
|
|
} |
613
|
|
|
|
614
|
|
|
|
615
|
|
|
|
616
|
|
|
/** |
617
|
|
|
* @param string $table_column |
618
|
|
|
* @param string $nice_name |
619
|
|
|
* @param bool $nullable |
620
|
|
|
* @return EE_WP_User_Field |
621
|
|
|
*/ |
622
|
|
|
public function createWpUserField($table_column, $nice_name, $nullable) |
623
|
|
|
{ |
624
|
|
|
return $this->loader->getNew('EE_WP_User_Field', array($table_column, $nice_name, $nullable)); |
625
|
|
|
} |
626
|
|
|
|
627
|
|
|
|
628
|
|
|
|
629
|
|
|
} |
630
|
|
|
// Location: core/services/database/ModelFieldFactory.php |
631
|
|
|
|
This check looks for PHPDoc comments describing methods or function parameters that do not exist on the corresponding method or function.
Consider the following example. The parameter
$italy
is not defined by the methodfinale(...)
.The most likely cause is that the parameter was removed, but the annotation was not.