Merge pull request #20331 from mattwire/suppresslegacywarnings
[civicrm-core.git] / CRM / Financial / DAO / PaymentToken.php
1 <?php
2
3 /**
4 * @package CRM
5 * @copyright CiviCRM LLC https://civicrm.org/licensing
6 *
7 * Generated from xml/schema/CRM/Financial/PaymentToken.xml
8 * DO NOT EDIT. Generated by CRM_Core_CodeGen
9 * (GenCodeChecksum:03492b5f23f8ab161d3515587ed50470)
10 */
11
12 /**
13 * Database access object for the PaymentToken entity.
14 */
15 class CRM_Financial_DAO_PaymentToken extends CRM_Core_DAO {
16 const EXT = 'civicrm';
17 const TABLE_ADDED = '4.6';
18 const COMPONENT = 'CiviContribute';
19
20 /**
21 * Static instance to hold the table name.
22 *
23 * @var string
24 */
25 public static $_tableName = 'civicrm_payment_token';
26
27 /**
28 * Should CiviCRM log any modifications to this table in the civicrm_log table.
29 *
30 * @var bool
31 */
32 public static $_log = FALSE;
33
34 /**
35 * Payment Token ID
36 *
37 * @var int
38 */
39 public $id;
40
41 /**
42 * FK to Contact ID for the owner of the token
43 *
44 * @var int
45 */
46 public $contact_id;
47
48 /**
49 * @var int
50 */
51 public $payment_processor_id;
52
53 /**
54 * Externally provided token string
55 *
56 * @var string
57 */
58 public $token;
59
60 /**
61 * Date created
62 *
63 * @var timestamp
64 */
65 public $created_date;
66
67 /**
68 * Contact ID of token creator
69 *
70 * @var int
71 */
72 public $created_id;
73
74 /**
75 * Date this token expires
76 *
77 * @var datetime
78 */
79 public $expiry_date;
80
81 /**
82 * Email at the time of token creation. Useful for fraud forensics
83 *
84 * @var string
85 */
86 public $email;
87
88 /**
89 * Billing first name at the time of token creation. Useful for fraud forensics
90 *
91 * @var string
92 */
93 public $billing_first_name;
94
95 /**
96 * Billing middle name at the time of token creation. Useful for fraud forensics
97 *
98 * @var string
99 */
100 public $billing_middle_name;
101
102 /**
103 * Billing last name at the time of token creation. Useful for fraud forensics
104 *
105 * @var string
106 */
107 public $billing_last_name;
108
109 /**
110 * Holds the part of the card number or account details that may be retained or displayed
111 *
112 * @var string
113 */
114 public $masked_account_number;
115
116 /**
117 * IP used when creating the token. Useful for fraud forensics
118 *
119 * @var string
120 */
121 public $ip_address;
122
123 /**
124 * Class constructor.
125 */
126 public function __construct() {
127 $this->__table = 'civicrm_payment_token';
128 parent::__construct();
129 }
130
131 /**
132 * Returns localized title of this entity.
133 *
134 * @param bool $plural
135 * Whether to return the plural version of the title.
136 */
137 public static function getEntityTitle($plural = FALSE) {
138 return $plural ? ts('Payment Tokens') : ts('Payment Token');
139 }
140
141 /**
142 * Returns foreign keys and entity references.
143 *
144 * @return array
145 * [CRM_Core_Reference_Interface]
146 */
147 public static function getReferenceColumns() {
148 if (!isset(Civi::$statics[__CLASS__]['links'])) {
149 Civi::$statics[__CLASS__]['links'] = static::createReferenceColumns(__CLASS__);
150 Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'contact_id', 'civicrm_contact', 'id');
151 Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'payment_processor_id', 'civicrm_payment_processor', 'id');
152 Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'created_id', 'civicrm_contact', 'id');
153 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'links_callback', Civi::$statics[__CLASS__]['links']);
154 }
155 return Civi::$statics[__CLASS__]['links'];
156 }
157
158 /**
159 * Returns all the column names of this table
160 *
161 * @return array
162 */
163 public static function &fields() {
164 if (!isset(Civi::$statics[__CLASS__]['fields'])) {
165 Civi::$statics[__CLASS__]['fields'] = [
166 'payment_token_id' => [
167 'name' => 'id',
168 'type' => CRM_Utils_Type::T_INT,
169 'title' => ts('Payment Token ID'),
170 'description' => ts('Payment Token ID'),
171 'required' => TRUE,
172 'where' => 'civicrm_payment_token.id',
173 'table_name' => 'civicrm_payment_token',
174 'entity' => 'PaymentToken',
175 'bao' => 'CRM_Financial_DAO_PaymentToken',
176 'localizable' => 0,
177 'html' => [
178 'type' => 'Number',
179 ],
180 'readonly' => TRUE,
181 'add' => '4.6',
182 ],
183 'contact_id' => [
184 'name' => 'contact_id',
185 'type' => CRM_Utils_Type::T_INT,
186 'title' => ts('Contact ID'),
187 'description' => ts('FK to Contact ID for the owner of the token'),
188 'required' => TRUE,
189 'where' => 'civicrm_payment_token.contact_id',
190 'table_name' => 'civicrm_payment_token',
191 'entity' => 'PaymentToken',
192 'bao' => 'CRM_Financial_DAO_PaymentToken',
193 'localizable' => 0,
194 'FKClassName' => 'CRM_Contact_DAO_Contact',
195 'html' => [
196 'label' => ts("Contact"),
197 ],
198 'add' => '4.6',
199 ],
200 'payment_processor_id' => [
201 'name' => 'payment_processor_id',
202 'type' => CRM_Utils_Type::T_INT,
203 'title' => ts('Payment Processor ID'),
204 'required' => TRUE,
205 'where' => 'civicrm_payment_token.payment_processor_id',
206 'table_name' => 'civicrm_payment_token',
207 'entity' => 'PaymentToken',
208 'bao' => 'CRM_Financial_DAO_PaymentToken',
209 'localizable' => 0,
210 'FKClassName' => 'CRM_Financial_DAO_PaymentProcessor',
211 'html' => [
212 'label' => ts("Payment Processor"),
213 ],
214 'add' => '4.6',
215 ],
216 'token' => [
217 'name' => 'token',
218 'type' => CRM_Utils_Type::T_STRING,
219 'title' => ts('Token'),
220 'description' => ts('Externally provided token string'),
221 'required' => TRUE,
222 'maxlength' => 255,
223 'size' => CRM_Utils_Type::HUGE,
224 'where' => 'civicrm_payment_token.token',
225 'table_name' => 'civicrm_payment_token',
226 'entity' => 'PaymentToken',
227 'bao' => 'CRM_Financial_DAO_PaymentToken',
228 'localizable' => 0,
229 'add' => '4.6',
230 ],
231 'created_date' => [
232 'name' => 'created_date',
233 'type' => CRM_Utils_Type::T_TIMESTAMP,
234 'title' => ts('Created Date'),
235 'description' => ts('Date created'),
236 'where' => 'civicrm_payment_token.created_date',
237 'default' => 'CURRENT_TIMESTAMP',
238 'table_name' => 'civicrm_payment_token',
239 'entity' => 'PaymentToken',
240 'bao' => 'CRM_Financial_DAO_PaymentToken',
241 'localizable' => 0,
242 'add' => '4.6',
243 ],
244 'created_id' => [
245 'name' => 'created_id',
246 'type' => CRM_Utils_Type::T_INT,
247 'title' => ts('Created ID'),
248 'description' => ts('Contact ID of token creator'),
249 'where' => 'civicrm_payment_token.created_id',
250 'table_name' => 'civicrm_payment_token',
251 'entity' => 'PaymentToken',
252 'bao' => 'CRM_Financial_DAO_PaymentToken',
253 'localizable' => 0,
254 'FKClassName' => 'CRM_Contact_DAO_Contact',
255 'html' => [
256 'label' => ts("Created"),
257 ],
258 'add' => '4.6',
259 ],
260 'expiry_date' => [
261 'name' => 'expiry_date',
262 'type' => CRM_Utils_Type::T_DATE + CRM_Utils_Type::T_TIME,
263 'title' => ts('Expiry Date'),
264 'description' => ts('Date this token expires'),
265 'where' => 'civicrm_payment_token.expiry_date',
266 'table_name' => 'civicrm_payment_token',
267 'entity' => 'PaymentToken',
268 'bao' => 'CRM_Financial_DAO_PaymentToken',
269 'localizable' => 0,
270 'add' => '4.6',
271 ],
272 'email' => [
273 'name' => 'email',
274 'type' => CRM_Utils_Type::T_STRING,
275 'title' => ts('Email'),
276 'description' => ts('Email at the time of token creation. Useful for fraud forensics'),
277 'maxlength' => 255,
278 'size' => CRM_Utils_Type::HUGE,
279 'where' => 'civicrm_payment_token.email',
280 'table_name' => 'civicrm_payment_token',
281 'entity' => 'PaymentToken',
282 'bao' => 'CRM_Financial_DAO_PaymentToken',
283 'localizable' => 0,
284 'add' => '4.6',
285 ],
286 'billing_first_name' => [
287 'name' => 'billing_first_name',
288 'type' => CRM_Utils_Type::T_STRING,
289 'title' => ts('Billing First Name'),
290 'description' => ts('Billing first name at the time of token creation. Useful for fraud forensics'),
291 'maxlength' => 255,
292 'size' => CRM_Utils_Type::HUGE,
293 'where' => 'civicrm_payment_token.billing_first_name',
294 'table_name' => 'civicrm_payment_token',
295 'entity' => 'PaymentToken',
296 'bao' => 'CRM_Financial_DAO_PaymentToken',
297 'localizable' => 0,
298 'add' => '4.6',
299 ],
300 'billing_middle_name' => [
301 'name' => 'billing_middle_name',
302 'type' => CRM_Utils_Type::T_STRING,
303 'title' => ts('Billing Middle Name'),
304 'description' => ts('Billing middle name at the time of token creation. Useful for fraud forensics'),
305 'maxlength' => 255,
306 'size' => CRM_Utils_Type::HUGE,
307 'where' => 'civicrm_payment_token.billing_middle_name',
308 'table_name' => 'civicrm_payment_token',
309 'entity' => 'PaymentToken',
310 'bao' => 'CRM_Financial_DAO_PaymentToken',
311 'localizable' => 0,
312 'add' => '4.6',
313 ],
314 'billing_last_name' => [
315 'name' => 'billing_last_name',
316 'type' => CRM_Utils_Type::T_STRING,
317 'title' => ts('Billing Last Name'),
318 'description' => ts('Billing last name at the time of token creation. Useful for fraud forensics'),
319 'maxlength' => 255,
320 'size' => CRM_Utils_Type::HUGE,
321 'where' => 'civicrm_payment_token.billing_last_name',
322 'table_name' => 'civicrm_payment_token',
323 'entity' => 'PaymentToken',
324 'bao' => 'CRM_Financial_DAO_PaymentToken',
325 'localizable' => 0,
326 'add' => '4.6',
327 ],
328 'masked_account_number' => [
329 'name' => 'masked_account_number',
330 'type' => CRM_Utils_Type::T_STRING,
331 'title' => ts('Masked Account Number'),
332 'description' => ts('Holds the part of the card number or account details that may be retained or displayed'),
333 'maxlength' => 255,
334 'size' => CRM_Utils_Type::HUGE,
335 'where' => 'civicrm_payment_token.masked_account_number',
336 'table_name' => 'civicrm_payment_token',
337 'entity' => 'PaymentToken',
338 'bao' => 'CRM_Financial_DAO_PaymentToken',
339 'localizable' => 0,
340 'add' => '4.6',
341 ],
342 'ip_address' => [
343 'name' => 'ip_address',
344 'type' => CRM_Utils_Type::T_STRING,
345 'title' => ts('IP Address'),
346 'description' => ts('IP used when creating the token. Useful for fraud forensics'),
347 'maxlength' => 255,
348 'size' => CRM_Utils_Type::HUGE,
349 'where' => 'civicrm_payment_token.ip_address',
350 'table_name' => 'civicrm_payment_token',
351 'entity' => 'PaymentToken',
352 'bao' => 'CRM_Financial_DAO_PaymentToken',
353 'localizable' => 0,
354 'add' => '4.6',
355 ],
356 ];
357 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']);
358 }
359 return Civi::$statics[__CLASS__]['fields'];
360 }
361
362 /**
363 * Return a mapping from field-name to the corresponding key (as used in fields()).
364 *
365 * @return array
366 * Array(string $name => string $uniqueName).
367 */
368 public static function &fieldKeys() {
369 if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) {
370 Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields()));
371 }
372 return Civi::$statics[__CLASS__]['fieldKeys'];
373 }
374
375 /**
376 * Returns the names of this table
377 *
378 * @return string
379 */
380 public static function getTableName() {
381 return self::$_tableName;
382 }
383
384 /**
385 * Returns if this table needs to be logged
386 *
387 * @return bool
388 */
389 public function getLog() {
390 return self::$_log;
391 }
392
393 /**
394 * Returns the list of fields that can be imported
395 *
396 * @param bool $prefix
397 *
398 * @return array
399 */
400 public static function &import($prefix = FALSE) {
401 $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'payment_token', $prefix, []);
402 return $r;
403 }
404
405 /**
406 * Returns the list of fields that can be exported
407 *
408 * @param bool $prefix
409 *
410 * @return array
411 */
412 public static function &export($prefix = FALSE) {
413 $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'payment_token', $prefix, []);
414 return $r;
415 }
416
417 /**
418 * Returns the list of indices
419 *
420 * @param bool $localize
421 *
422 * @return array
423 */
424 public static function indices($localize = TRUE) {
425 $indices = [];
426 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices;
427 }
428
429 }