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