Commit | Line | Data |
---|---|---|
e501603b | 1 | <?php |
c3fc2621 | 2 | |
e501603b TO |
3 | /** |
4 | * @package CRM | |
ca5cec67 | 5 | * @copyright CiviCRM LLC https://civicrm.org/licensing |
e501603b TO |
6 | * |
7 | * Generated from xml/schema/CRM/Grant/Grant.xml | |
8 | * DO NOT EDIT. Generated by CRM_Core_CodeGen | |
a9d0587b | 9 | * (GenCodeChecksum:b09a04b8edb982e838510dfb9d7dbc35) |
e501603b | 10 | */ |
c3fc2621 | 11 | |
f41f0342 | 12 | /** |
c3fc2621 | 13 | * Database access object for the Grant entity. |
f41f0342 | 14 | */ |
e501603b | 15 | class CRM_Grant_DAO_Grant 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_grant'; |
c3fc2621 | 23 | |
449c4e6b CW |
24 | /** |
25 | * Icon associated with this entity. | |
26 | * | |
27 | * @var string | |
28 | */ | |
29 | public static $_icon = 'fa-money'; | |
30 | ||
e501603b | 31 | /** |
f41f0342 | 32 | * Should CiviCRM log any modifications to this table in the civicrm_log table. |
e501603b | 33 | * |
c3fc2621 | 34 | * @var bool |
e501603b | 35 | */ |
fa45b5b9 | 36 | public static $_log = TRUE; |
c3fc2621 | 37 | |
e501603b TO |
38 | /** |
39 | * Unique Grant id | |
40 | * | |
e6ca0a57 | 41 | * @var int |
e501603b TO |
42 | */ |
43 | public $id; | |
c3fc2621 | 44 | |
e501603b TO |
45 | /** |
46 | * Contact ID of contact record given grant belongs to. | |
47 | * | |
e6ca0a57 | 48 | * @var int |
e501603b TO |
49 | */ |
50 | public $contact_id; | |
c3fc2621 | 51 | |
e501603b TO |
52 | /** |
53 | * Date on which grant application was received by donor. | |
54 | * | |
55 | * @var date | |
56 | */ | |
57 | public $application_received_date; | |
c3fc2621 | 58 | |
e501603b TO |
59 | /** |
60 | * Date on which grant decision was made. | |
61 | * | |
62 | * @var date | |
63 | */ | |
64 | public $decision_date; | |
c3fc2621 | 65 | |
e501603b TO |
66 | /** |
67 | * Date on which grant money transfer was made. | |
68 | * | |
69 | * @var date | |
70 | */ | |
71 | public $money_transfer_date; | |
c3fc2621 | 72 | |
e501603b TO |
73 | /** |
74 | * Date on which grant report is due. | |
75 | * | |
76 | * @var date | |
77 | */ | |
78 | public $grant_due_date; | |
c3fc2621 | 79 | |
e501603b TO |
80 | /** |
81 | * Yes/No field stating whether grant report was received by donor. | |
82 | * | |
e6ca0a57 | 83 | * @var bool |
e501603b TO |
84 | */ |
85 | public $grant_report_received; | |
c3fc2621 | 86 | |
e501603b TO |
87 | /** |
88 | * Type of grant. Implicit FK to civicrm_option_value in grant_type option_group. | |
89 | * | |
e6ca0a57 | 90 | * @var int |
e501603b TO |
91 | */ |
92 | public $grant_type_id; | |
c3fc2621 | 93 | |
e501603b TO |
94 | /** |
95 | * Requested grant amount, in default currency. | |
96 | * | |
97 | * @var float | |
98 | */ | |
99 | public $amount_total; | |
c3fc2621 | 100 | |
e501603b TO |
101 | /** |
102 | * Requested grant amount, in original currency (optional). | |
103 | * | |
104 | * @var float | |
105 | */ | |
106 | public $amount_requested; | |
c3fc2621 | 107 | |
e501603b TO |
108 | /** |
109 | * Granted amount, in default currency. | |
110 | * | |
111 | * @var float | |
112 | */ | |
113 | public $amount_granted; | |
c3fc2621 | 114 | |
e501603b TO |
115 | /** |
116 | * 3 character string, value from config setting or input via user. | |
117 | * | |
118 | * @var string | |
119 | */ | |
120 | public $currency; | |
c3fc2621 | 121 | |
e501603b TO |
122 | /** |
123 | * Grant rationale. | |
124 | * | |
125 | * @var text | |
126 | */ | |
127 | public $rationale; | |
c3fc2621 | 128 | |
e501603b TO |
129 | /** |
130 | * Id of Grant status. | |
131 | * | |
e6ca0a57 | 132 | * @var int |
e501603b TO |
133 | */ |
134 | public $status_id; | |
c3fc2621 | 135 | |
e501603b TO |
136 | /** |
137 | * FK to Financial Type. | |
138 | * | |
e6ca0a57 | 139 | * @var int |
e501603b TO |
140 | */ |
141 | public $financial_type_id; | |
c3fc2621 | 142 | |
e501603b | 143 | /** |
f41f0342 | 144 | * Class constructor. |
e501603b | 145 | */ |
c3fc2621 | 146 | public function __construct() { |
e501603b TO |
147 | $this->__table = 'civicrm_grant'; |
148 | parent::__construct(); | |
149 | } | |
c3fc2621 | 150 | |
449c4e6b CW |
151 | /** |
152 | * Returns localized title of this entity. | |
153 | */ | |
154 | public static function getEntityTitle() { | |
155 | return ts('Grants'); | |
156 | } | |
157 | ||
e501603b | 158 | /** |
f41f0342 | 159 | * Returns foreign keys and entity references. |
e501603b TO |
160 | * |
161 | * @return array | |
162 | * [CRM_Core_Reference_Interface] | |
163 | */ | |
c3fc2621 | 164 | public static function getReferenceColumns() { |
346aaaba | 165 | if (!isset(Civi::$statics[__CLASS__]['links'])) { |
fa45b5b9 | 166 | Civi::$statics[__CLASS__]['links'] = static::createReferenceColumns(__CLASS__); |
c3fc2621 CW |
167 | Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'contact_id', 'civicrm_contact', 'id'); |
168 | Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'financial_type_id', 'civicrm_financial_type', 'id'); | |
346aaaba | 169 | CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'links_callback', Civi::$statics[__CLASS__]['links']); |
e501603b | 170 | } |
346aaaba | 171 | return Civi::$statics[__CLASS__]['links']; |
e501603b | 172 | } |
c3fc2621 | 173 | |
e501603b TO |
174 | /** |
175 | * Returns all the column names of this table | |
176 | * | |
177 | * @return array | |
178 | */ | |
c3fc2621 | 179 | public static function &fields() { |
346aaaba | 180 | if (!isset(Civi::$statics[__CLASS__]['fields'])) { |
c3fc2621 CW |
181 | Civi::$statics[__CLASS__]['fields'] = [ |
182 | 'grant_id' => [ | |
e501603b TO |
183 | 'name' => 'id', |
184 | 'type' => CRM_Utils_Type::T_INT, | |
c3fc2621 | 185 | 'title' => ts('Grant ID'), |
215b423e | 186 | 'description' => ts('Unique Grant id'), |
c3fc2621 CW |
187 | 'required' => TRUE, |
188 | 'import' => TRUE, | |
e501603b | 189 | 'where' => 'civicrm_grant.id', |
c3fc2621 | 190 | 'export' => TRUE, |
522a26c9 | 191 | 'table_name' => 'civicrm_grant', |
192 | 'entity' => 'Grant', | |
193 | 'bao' => 'CRM_Grant_BAO_Grant', | |
6a7e5e5d | 194 | 'localizable' => 0, |
a9d0587b | 195 | 'add' => '1.8', |
c3fc2621 CW |
196 | ], |
197 | 'grant_contact_id' => [ | |
e501603b TO |
198 | 'name' => 'contact_id', |
199 | 'type' => CRM_Utils_Type::T_INT, | |
c3fc2621 | 200 | 'title' => ts('Contact ID'), |
215b423e | 201 | 'description' => ts('Contact ID of contact record given grant belongs to.'), |
c3fc2621 | 202 | 'required' => TRUE, |
e501603b | 203 | 'where' => 'civicrm_grant.contact_id', |
a36434b9 | 204 | 'export' => TRUE, |
522a26c9 | 205 | 'table_name' => 'civicrm_grant', |
206 | 'entity' => 'Grant', | |
207 | 'bao' => 'CRM_Grant_BAO_Grant', | |
6a7e5e5d | 208 | 'localizable' => 0, |
e501603b | 209 | 'FKClassName' => 'CRM_Contact_DAO_Contact', |
c3fc2621 | 210 | 'html' => [ |
e501603b | 211 | 'type' => 'EntityRef', |
c3fc2621 | 212 | ], |
a9d0587b | 213 | 'add' => '1.8', |
c3fc2621 | 214 | ], |
0bcac7e7 | 215 | 'grant_application_received_date' => [ |
e501603b TO |
216 | 'name' => 'application_received_date', |
217 | 'type' => CRM_Utils_Type::T_DATE, | |
c3fc2621 | 218 | 'title' => ts('Application received date'), |
215b423e | 219 | 'description' => ts('Date on which grant application was received by donor.'), |
ae7f34ec | 220 | 'import' => TRUE, |
e501603b | 221 | 'where' => 'civicrm_grant.application_received_date', |
ae7f34ec | 222 | 'export' => TRUE, |
522a26c9 | 223 | 'table_name' => 'civicrm_grant', |
224 | 'entity' => 'Grant', | |
225 | 'bao' => 'CRM_Grant_BAO_Grant', | |
6a7e5e5d | 226 | 'localizable' => 0, |
ae7f34ec PN |
227 | 'html' => [ |
228 | 'type' => 'Select Date', | |
229 | 'formatType' => 'activityDate', | |
230 | ], | |
a9d0587b | 231 | 'add' => '1.8', |
c3fc2621 | 232 | ], |
0bcac7e7 | 233 | 'grant_decision_date' => [ |
e501603b TO |
234 | 'name' => 'decision_date', |
235 | 'type' => CRM_Utils_Type::T_DATE, | |
c3fc2621 | 236 | 'title' => ts('Decision date'), |
215b423e | 237 | 'description' => ts('Date on which grant decision was made.'), |
c3fc2621 | 238 | 'import' => TRUE, |
e501603b | 239 | 'where' => 'civicrm_grant.decision_date', |
c3fc2621 | 240 | 'export' => TRUE, |
522a26c9 | 241 | 'table_name' => 'civicrm_grant', |
242 | 'entity' => 'Grant', | |
243 | 'bao' => 'CRM_Grant_BAO_Grant', | |
6a7e5e5d | 244 | 'localizable' => 0, |
c3fc2621 | 245 | 'html' => [ |
e501603b | 246 | 'type' => 'Select Date', |
ae7f34ec | 247 | 'formatType' => 'activityDate', |
c3fc2621 | 248 | ], |
a9d0587b | 249 | 'add' => '1.8', |
c3fc2621 CW |
250 | ], |
251 | 'grant_money_transfer_date' => [ | |
e501603b TO |
252 | 'name' => 'money_transfer_date', |
253 | 'type' => CRM_Utils_Type::T_DATE, | |
c3fc2621 | 254 | 'title' => ts('Grant Money transfer date'), |
215b423e | 255 | 'description' => ts('Date on which grant money transfer was made.'), |
c3fc2621 | 256 | 'import' => TRUE, |
e501603b | 257 | 'where' => 'civicrm_grant.money_transfer_date', |
c3fc2621 | 258 | 'export' => TRUE, |
522a26c9 | 259 | 'table_name' => 'civicrm_grant', |
260 | 'entity' => 'Grant', | |
261 | 'bao' => 'CRM_Grant_BAO_Grant', | |
6a7e5e5d | 262 | 'localizable' => 0, |
c3fc2621 | 263 | 'html' => [ |
e501603b | 264 | 'type' => 'Select Date', |
ae7f34ec | 265 | 'formatType' => 'activityDate', |
c3fc2621 | 266 | ], |
a9d0587b | 267 | 'add' => '1.8', |
c3fc2621 CW |
268 | ], |
269 | 'grant_due_date' => [ | |
e501603b TO |
270 | 'name' => 'grant_due_date', |
271 | 'type' => CRM_Utils_Type::T_DATE, | |
0bcac7e7 | 272 | 'title' => ts('Grant Report Due Date'), |
215b423e | 273 | 'description' => ts('Date on which grant report is due.'), |
ae7f34ec PN |
274 | 'import' => TRUE, |
275 | 'where' => 'civicrm_grant.grant_due_date', | |
ae7f34ec | 276 | 'export' => TRUE, |
522a26c9 | 277 | 'table_name' => 'civicrm_grant', |
278 | 'entity' => 'Grant', | |
279 | 'bao' => 'CRM_Grant_BAO_Grant', | |
6a7e5e5d | 280 | 'localizable' => 0, |
c3fc2621 | 281 | 'html' => [ |
e501603b | 282 | 'type' => 'Select Date', |
ae7f34ec | 283 | 'formatType' => 'activityDate', |
c3fc2621 | 284 | ], |
a9d0587b | 285 | 'add' => '1.8', |
c3fc2621 CW |
286 | ], |
287 | 'grant_report_received' => [ | |
e501603b TO |
288 | 'name' => 'grant_report_received', |
289 | 'type' => CRM_Utils_Type::T_BOOLEAN, | |
c3fc2621 | 290 | 'title' => ts('Grant report received'), |
215b423e | 291 | 'description' => ts('Yes/No field stating whether grant report was received by donor.'), |
c3fc2621 | 292 | 'import' => TRUE, |
e501603b | 293 | 'where' => 'civicrm_grant.grant_report_received', |
c3fc2621 | 294 | 'export' => TRUE, |
522a26c9 | 295 | 'table_name' => 'civicrm_grant', |
296 | 'entity' => 'Grant', | |
297 | 'bao' => 'CRM_Grant_BAO_Grant', | |
6a7e5e5d | 298 | 'localizable' => 0, |
c3fc2621 | 299 | 'html' => [ |
e501603b | 300 | 'type' => 'CheckBox', |
c3fc2621 | 301 | ], |
a9d0587b | 302 | 'add' => '1.8', |
c3fc2621 CW |
303 | ], |
304 | 'grant_type_id' => [ | |
e501603b TO |
305 | 'name' => 'grant_type_id', |
306 | 'type' => CRM_Utils_Type::T_INT, | |
c3fc2621 | 307 | 'title' => ts('Grant Type'), |
215b423e | 308 | 'description' => ts('Type of grant. Implicit FK to civicrm_option_value in grant_type option_group.'), |
c3fc2621 | 309 | 'required' => TRUE, |
e501603b | 310 | 'where' => 'civicrm_grant.grant_type_id', |
a36434b9 | 311 | 'export' => TRUE, |
522a26c9 | 312 | 'table_name' => 'civicrm_grant', |
313 | 'entity' => 'Grant', | |
314 | 'bao' => 'CRM_Grant_BAO_Grant', | |
6a7e5e5d | 315 | 'localizable' => 0, |
c3fc2621 | 316 | 'html' => [ |
e501603b | 317 | 'type' => 'Select', |
c3fc2621 CW |
318 | ], |
319 | 'pseudoconstant' => [ | |
e501603b TO |
320 | 'optionGroupName' => 'grant_type', |
321 | 'optionEditPath' => 'civicrm/admin/options/grant_type', | |
e6ca0a57 | 322 | ], |
a9d0587b | 323 | 'add' => '1.8', |
c3fc2621 CW |
324 | ], |
325 | 'amount_total' => [ | |
e501603b TO |
326 | 'name' => 'amount_total', |
327 | 'type' => CRM_Utils_Type::T_MONEY, | |
c3fc2621 | 328 | 'title' => ts('Total Amount'), |
215b423e | 329 | 'description' => ts('Requested grant amount, in default currency.'), |
c3fc2621 CW |
330 | 'required' => TRUE, |
331 | 'precision' => [ | |
e501603b | 332 | 20, |
fb607354 | 333 | 2, |
c3fc2621 CW |
334 | ], |
335 | 'import' => TRUE, | |
e501603b | 336 | 'where' => 'civicrm_grant.amount_total', |
e501603b | 337 | 'dataPattern' => '/^\d+(\.\d{2})?$/', |
c3fc2621 | 338 | 'export' => TRUE, |
522a26c9 | 339 | 'table_name' => 'civicrm_grant', |
340 | 'entity' => 'Grant', | |
341 | 'bao' => 'CRM_Grant_BAO_Grant', | |
6a7e5e5d | 342 | 'localizable' => 0, |
c3fc2621 | 343 | 'html' => [ |
e501603b | 344 | 'type' => 'Text', |
c3fc2621 | 345 | ], |
a9d0587b | 346 | 'add' => '1.8', |
c3fc2621 CW |
347 | ], |
348 | 'amount_requested' => [ | |
e501603b TO |
349 | 'name' => 'amount_requested', |
350 | 'type' => CRM_Utils_Type::T_MONEY, | |
c3fc2621 | 351 | 'title' => ts('Amount Requested'), |
215b423e | 352 | 'description' => ts('Requested grant amount, in original currency (optional).'), |
c3fc2621 | 353 | 'precision' => [ |
e501603b | 354 | 20, |
fb607354 | 355 | 2, |
c3fc2621 | 356 | ], |
a36434b9 | 357 | 'where' => 'civicrm_grant.amount_requested', |
358 | 'dataPattern' => '/^\d+(\.\d{2})?$/', | |
522a26c9 | 359 | 'table_name' => 'civicrm_grant', |
360 | 'entity' => 'Grant', | |
361 | 'bao' => 'CRM_Grant_BAO_Grant', | |
6a7e5e5d | 362 | 'localizable' => 0, |
c3fc2621 | 363 | 'html' => [ |
e501603b | 364 | 'type' => 'Text', |
c3fc2621 | 365 | ], |
a9d0587b | 366 | 'add' => '1.8', |
c3fc2621 CW |
367 | ], |
368 | 'amount_granted' => [ | |
e501603b TO |
369 | 'name' => 'amount_granted', |
370 | 'type' => CRM_Utils_Type::T_MONEY, | |
c3fc2621 | 371 | 'title' => ts('Amount granted'), |
215b423e | 372 | 'description' => ts('Granted amount, in default currency.'), |
c3fc2621 | 373 | 'precision' => [ |
e501603b | 374 | 20, |
fb607354 | 375 | 2, |
c3fc2621 CW |
376 | ], |
377 | 'import' => TRUE, | |
e501603b | 378 | 'where' => 'civicrm_grant.amount_granted', |
e501603b | 379 | 'dataPattern' => '/^\d+(\.\d{2})?$/', |
c3fc2621 | 380 | 'export' => TRUE, |
522a26c9 | 381 | 'table_name' => 'civicrm_grant', |
382 | 'entity' => 'Grant', | |
383 | 'bao' => 'CRM_Grant_BAO_Grant', | |
6a7e5e5d | 384 | 'localizable' => 0, |
c3fc2621 | 385 | 'html' => [ |
e501603b | 386 | 'type' => 'Text', |
c3fc2621 | 387 | ], |
a9d0587b | 388 | 'add' => '1.8', |
c3fc2621 CW |
389 | ], |
390 | 'currency' => [ | |
e501603b TO |
391 | 'name' => 'currency', |
392 | 'type' => CRM_Utils_Type::T_STRING, | |
c3fc2621 | 393 | 'title' => ts('Grant Currency'), |
215b423e | 394 | 'description' => ts('3 character string, value from config setting or input via user.'), |
c3fc2621 | 395 | 'required' => TRUE, |
e501603b TO |
396 | 'maxlength' => 3, |
397 | 'size' => CRM_Utils_Type::FOUR, | |
a36434b9 | 398 | 'where' => 'civicrm_grant.currency', |
522a26c9 | 399 | 'table_name' => 'civicrm_grant', |
400 | 'entity' => 'Grant', | |
401 | 'bao' => 'CRM_Grant_BAO_Grant', | |
6a7e5e5d | 402 | 'localizable' => 0, |
c3fc2621 | 403 | 'html' => [ |
e501603b | 404 | 'type' => 'Select', |
c3fc2621 CW |
405 | ], |
406 | 'pseudoconstant' => [ | |
e501603b TO |
407 | 'table' => 'civicrm_currency', |
408 | 'keyColumn' => 'name', | |
409 | 'labelColumn' => 'full_name', | |
410 | 'nameColumn' => 'name', | |
a8fdb24e | 411 | 'abbrColumn' => 'symbol', |
e6ca0a57 | 412 | ], |
a9d0587b | 413 | 'add' => '3.2', |
c3fc2621 CW |
414 | ], |
415 | 'rationale' => [ | |
e501603b TO |
416 | 'name' => 'rationale', |
417 | 'type' => CRM_Utils_Type::T_TEXT, | |
c3fc2621 | 418 | 'title' => ts('Grant Rationale'), |
215b423e | 419 | 'description' => ts('Grant rationale.'), |
e501603b TO |
420 | 'rows' => 4, |
421 | 'cols' => 60, | |
c3fc2621 | 422 | 'import' => TRUE, |
e501603b | 423 | 'where' => 'civicrm_grant.rationale', |
c3fc2621 | 424 | 'export' => TRUE, |
522a26c9 | 425 | 'table_name' => 'civicrm_grant', |
426 | 'entity' => 'Grant', | |
427 | 'bao' => 'CRM_Grant_BAO_Grant', | |
6a7e5e5d | 428 | 'localizable' => 0, |
c3fc2621 | 429 | 'html' => [ |
e501603b | 430 | 'type' => 'TextArea', |
c3fc2621 | 431 | ], |
a9d0587b | 432 | 'add' => '1.8', |
c3fc2621 CW |
433 | ], |
434 | 'grant_status_id' => [ | |
e501603b TO |
435 | 'name' => 'status_id', |
436 | 'type' => CRM_Utils_Type::T_INT, | |
c3fc2621 | 437 | 'title' => ts('Grant Status'), |
215b423e | 438 | 'description' => ts('Id of Grant status.'), |
c3fc2621 CW |
439 | 'required' => TRUE, |
440 | 'import' => TRUE, | |
e501603b | 441 | 'where' => 'civicrm_grant.status_id', |
c3fc2621 | 442 | 'export' => FALSE, |
522a26c9 | 443 | 'table_name' => 'civicrm_grant', |
444 | 'entity' => 'Grant', | |
445 | 'bao' => 'CRM_Grant_BAO_Grant', | |
6a7e5e5d | 446 | 'localizable' => 0, |
c3fc2621 | 447 | 'html' => [ |
e501603b | 448 | 'type' => 'Select', |
c3fc2621 CW |
449 | ], |
450 | 'pseudoconstant' => [ | |
e501603b TO |
451 | 'optionGroupName' => 'grant_status', |
452 | 'optionEditPath' => 'civicrm/admin/options/grant_status', | |
e6ca0a57 | 453 | ], |
a9d0587b | 454 | 'add' => '1.8', |
c3fc2621 CW |
455 | ], |
456 | 'financial_type_id' => [ | |
e501603b TO |
457 | 'name' => 'financial_type_id', |
458 | 'type' => CRM_Utils_Type::T_INT, | |
c3fc2621 | 459 | 'title' => ts('Financial Type'), |
215b423e | 460 | 'description' => ts('FK to Financial Type.'), |
a36434b9 | 461 | 'where' => 'civicrm_grant.financial_type_id', |
e501603b | 462 | 'default' => 'NULL', |
522a26c9 | 463 | 'table_name' => 'civicrm_grant', |
464 | 'entity' => 'Grant', | |
465 | 'bao' => 'CRM_Grant_BAO_Grant', | |
6a7e5e5d | 466 | 'localizable' => 0, |
e501603b | 467 | 'FKClassName' => 'CRM_Financial_DAO_FinancialType', |
c3fc2621 | 468 | 'pseudoconstant' => [ |
e501603b TO |
469 | 'table' => 'civicrm_financial_type', |
470 | 'keyColumn' => 'id', | |
471 | 'labelColumn' => 'name', | |
e6ca0a57 | 472 | ], |
a9d0587b | 473 | 'add' => '4.3', |
c3fc2621 CW |
474 | ], |
475 | ]; | |
346aaaba | 476 | CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']); |
e501603b | 477 | } |
346aaaba | 478 | return Civi::$statics[__CLASS__]['fields']; |
e501603b | 479 | } |
c3fc2621 | 480 | |
e501603b | 481 | /** |
bd8e0b14 | 482 | * Return a mapping from field-name to the corresponding key (as used in fields()). |
e501603b TO |
483 | * |
484 | * @return array | |
bd8e0b14 | 485 | * Array(string $name => string $uniqueName). |
e501603b | 486 | */ |
c3fc2621 | 487 | public static function &fieldKeys() { |
bd8e0b14 TO |
488 | if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) { |
489 | Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields())); | |
e501603b | 490 | } |
bd8e0b14 | 491 | return Civi::$statics[__CLASS__]['fieldKeys']; |
e501603b | 492 | } |
c3fc2621 | 493 | |
e501603b TO |
494 | /** |
495 | * Returns the names of this table | |
496 | * | |
497 | * @return string | |
498 | */ | |
c3fc2621 | 499 | public static function getTableName() { |
e501603b TO |
500 | return self::$_tableName; |
501 | } | |
c3fc2621 | 502 | |
e501603b TO |
503 | /** |
504 | * Returns if this table needs to be logged | |
505 | * | |
c3fc2621 | 506 | * @return bool |
e501603b | 507 | */ |
c3fc2621 | 508 | public function getLog() { |
e501603b TO |
509 | return self::$_log; |
510 | } | |
c3fc2621 | 511 | |
e501603b TO |
512 | /** |
513 | * Returns the list of fields that can be imported | |
514 | * | |
515 | * @param bool $prefix | |
516 | * | |
517 | * @return array | |
518 | */ | |
c3fc2621 CW |
519 | public static function &import($prefix = FALSE) { |
520 | $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'grant', $prefix, []); | |
60808919 | 521 | return $r; |
e501603b | 522 | } |
c3fc2621 | 523 | |
e501603b TO |
524 | /** |
525 | * Returns the list of fields that can be exported | |
526 | * | |
527 | * @param bool $prefix | |
528 | * | |
529 | * @return array | |
530 | */ | |
c3fc2621 CW |
531 | public static function &export($prefix = FALSE) { |
532 | $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'grant', $prefix, []); | |
60808919 | 533 | return $r; |
e501603b | 534 | } |
c3fc2621 | 535 | |
e7a6b91a AS |
536 | /** |
537 | * Returns the list of indices | |
c3fc2621 CW |
538 | * |
539 | * @param bool $localize | |
540 | * | |
541 | * @return array | |
e7a6b91a AS |
542 | */ |
543 | public static function indices($localize = TRUE) { | |
c3fc2621 CW |
544 | $indices = [ |
545 | 'index_grant_type_id' => [ | |
e7a6b91a | 546 | 'name' => 'index_grant_type_id', |
c3fc2621 | 547 | 'field' => [ |
e7a6b91a | 548 | 0 => 'grant_type_id', |
c3fc2621 CW |
549 | ], |
550 | 'localizable' => FALSE, | |
e7a6b91a | 551 | 'sig' => 'civicrm_grant::0::grant_type_id', |
c3fc2621 CW |
552 | ], |
553 | 'index_status_id' => [ | |
e7a6b91a | 554 | 'name' => 'index_status_id', |
c3fc2621 | 555 | 'field' => [ |
e7a6b91a | 556 | 0 => 'status_id', |
c3fc2621 CW |
557 | ], |
558 | 'localizable' => FALSE, | |
e7a6b91a | 559 | 'sig' => 'civicrm_grant::0::status_id', |
c3fc2621 CW |
560 | ], |
561 | ]; | |
e7a6b91a AS |
562 | return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices; |
563 | } | |
c3fc2621 | 564 | |
e501603b | 565 | } |