1 | <?php |
||
17 | class EEM_Attendee extends EEM_CPT_Base |
||
18 | { |
||
19 | |||
20 | // private instance of the Attendee object |
||
21 | protected static $_instance = null; |
||
22 | |||
23 | /** |
||
24 | * QST_system for questions are strings not integers now, |
||
25 | * so these constants are deprecated. |
||
26 | * Please instead use the EEM_Attendee::system_question_* constants |
||
27 | * |
||
28 | * @deprecated |
||
29 | */ |
||
30 | const fname_question_id = 1; |
||
31 | |||
32 | /** |
||
33 | * @deprecated |
||
34 | */ |
||
35 | const lname_question_id = 2; |
||
36 | |||
37 | |||
38 | /** |
||
39 | * @deprecated |
||
40 | */ |
||
41 | const email_question_id = 3; |
||
42 | |||
43 | |||
44 | /** |
||
45 | * @deprecated |
||
46 | */ |
||
47 | const address_question_id = 4; |
||
48 | |||
49 | |||
50 | /** |
||
51 | * @deprecated |
||
52 | */ |
||
53 | const address2_question_id = 5; |
||
54 | |||
55 | |||
56 | /** |
||
57 | * @deprecated |
||
58 | */ |
||
59 | const city_question_id = 6; |
||
60 | |||
61 | |||
62 | /** |
||
63 | * @deprecated |
||
64 | */ |
||
65 | const state_question_id = 7; |
||
66 | |||
67 | |||
68 | /** |
||
69 | * @deprecated |
||
70 | */ |
||
71 | const country_question_id = 8; |
||
72 | |||
73 | |||
74 | /** |
||
75 | * @deprecated |
||
76 | */ |
||
77 | const zip_question_id = 9; |
||
78 | |||
79 | |||
80 | /** |
||
81 | * @deprecated |
||
82 | */ |
||
83 | const phone_question_id = 10; |
||
84 | |||
85 | /** |
||
86 | * When looking for questions that correspond to attendee fields, |
||
87 | * look for the question with this QST_system value. |
||
88 | * These replace the old constants like EEM_Attendee::*_question_id |
||
89 | */ |
||
90 | const system_question_fname = 'fname'; |
||
91 | |||
92 | const system_question_lname = 'lname'; |
||
93 | |||
94 | const system_question_email = 'email'; |
||
95 | |||
96 | const system_question_address = 'address'; |
||
97 | |||
98 | const system_question_address2 = 'address2'; |
||
99 | |||
100 | const system_question_city = 'city'; |
||
101 | |||
102 | const system_question_state = 'state'; |
||
103 | |||
104 | const system_question_country = 'country'; |
||
105 | |||
106 | const system_question_zip = 'zip'; |
||
107 | |||
108 | const system_question_phone = 'phone'; |
||
109 | |||
110 | /** |
||
111 | * Keys are all the EEM_Attendee::system_question_* constants, which are |
||
112 | * also all the values of QST_system in the questions table, and values |
||
113 | * are their corresponding Attendee field names |
||
114 | * |
||
115 | * @var array |
||
116 | */ |
||
117 | protected $_system_question_to_attendee_field_name = array( |
||
118 | EEM_Attendee::system_question_fname => 'ATT_fname', |
||
119 | EEM_Attendee::system_question_lname => 'ATT_lname', |
||
120 | EEM_Attendee::system_question_email => 'ATT_email', |
||
121 | EEM_Attendee::system_question_address => 'ATT_address', |
||
122 | EEM_Attendee::system_question_address2 => 'ATT_address2', |
||
123 | EEM_Attendee::system_question_city => 'ATT_city', |
||
124 | EEM_Attendee::system_question_state => 'STA_ID', |
||
125 | EEM_Attendee::system_question_country => 'CNT_ISO', |
||
126 | EEM_Attendee::system_question_zip => 'ATT_zip', |
||
127 | EEM_Attendee::system_question_phone => 'ATT_phone', |
||
128 | ); |
||
129 | |||
130 | |||
131 | |||
132 | /** |
||
133 | * EEM_Attendee constructor. |
||
134 | * |
||
135 | * @param null $timezone |
||
136 | * @param ModelFieldFactory $model_field_factory |
||
137 | * @throws EE_Error |
||
138 | * @throws InvalidArgumentException |
||
139 | */ |
||
140 | protected function __construct($timezone = null, ModelFieldFactory $model_field_factory) |
||
280 | |||
281 | |||
282 | |||
283 | /** |
||
284 | * Gets the name of the field on the attendee model corresponding to the system question string |
||
285 | * which should be one of the keys from EEM_Attendee::_system_question_to_attendee_field_name |
||
286 | * |
||
287 | * @param string $system_question_string |
||
288 | * @return string|null if not found |
||
289 | */ |
||
290 | public function get_attendee_field_for_system_question($system_question_string) |
||
296 | |||
297 | |||
298 | |||
299 | /** |
||
300 | * Gets mapping from esp_question.QST_system values to their corresponding attendee field names |
||
301 | * |
||
302 | * @return array |
||
303 | */ |
||
304 | public function system_question_to_attendee_field_mapping() |
||
308 | |||
309 | |||
310 | |||
311 | /** |
||
312 | * Gets all the attendees for a transaction (by using the esp_registration as a join table) |
||
313 | * |
||
314 | * @param EE_Transaction /int $transaction_id_or_obj EE_Transaction or its ID |
||
315 | * @return EE_Attendee[]|EE_Base_Class[] |
||
316 | * @throws EE_Error |
||
317 | */ |
||
318 | public function get_attendees_for_transaction($transaction_id_or_obj) |
||
330 | |||
331 | |||
332 | |||
333 | /** |
||
334 | * retrieve a single attendee from db via their ID |
||
335 | * |
||
336 | * @param $ATT_ID |
||
337 | * @return mixed array on success, FALSE on fail |
||
338 | * @deprecated |
||
339 | */ |
||
340 | public function get_attendee_by_ID($ATT_ID = false) |
||
345 | |||
346 | |||
347 | |||
348 | /** |
||
349 | * retrieve a single attendee from db via their ID |
||
350 | * |
||
351 | * @param array $where_cols_n_values |
||
352 | * @return mixed array on success, FALSE on fail |
||
353 | * @throws EE_Error |
||
354 | */ |
||
355 | public function get_attendee($where_cols_n_values = array()) |
||
366 | |||
367 | |||
368 | |||
369 | /** |
||
370 | * Search for an existing Attendee record in the DB |
||
371 | * |
||
372 | * @param array $where_cols_n_values |
||
373 | * @return bool|mixed |
||
374 | * @throws EE_Error |
||
375 | */ |
||
376 | public function find_existing_attendee($where_cols_n_values = null) |
||
407 | |||
408 | |||
409 | |||
410 | /** |
||
411 | * Takes an incoming array of EE_Registration ids |
||
412 | * and sends back a list of corresponding non duplicate EE_Attendee objects. |
||
413 | * |
||
414 | * @since 4.3.0 |
||
415 | * @param array $ids array of EE_Registration ids |
||
416 | * @return EE_Attendee[]|EE_Base_Class[] |
||
417 | * @throws EE_Error |
||
418 | */ |
||
419 | public function get_array_of_contacts_from_reg_ids($ids) |
||
427 | |||
428 | |||
429 | } |
||
430 | // End of file EEM_Attendee.model.php |
||
432 |