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