| 1 | <?php |
| 2 | |
| 3 | /** |
| 4 | * @package CRM |
| 5 | * @copyright CiviCRM LLC https://civicrm.org/licensing |
| 6 | * |
| 7 | * Generated from xml/schema/CRM/Core/UserJob.xml |
| 8 | * DO NOT EDIT. Generated by CRM_Core_CodeGen |
| 9 | * (GenCodeChecksum:fc2efbbf7b26018fe3dff0cda44ffa28) |
| 10 | */ |
| 11 | |
| 12 | /** |
| 13 | * Database access object for the UserJob entity. |
| 14 | */ |
| 15 | class CRM_Core_DAO_UserJob extends CRM_Core_DAO { |
| 16 | const EXT = 'civicrm'; |
| 17 | const TABLE_ADDED = '5.50'; |
| 18 | |
| 19 | /** |
| 20 | * Static instance to hold the table name. |
| 21 | * |
| 22 | * @var string |
| 23 | */ |
| 24 | public static $_tableName = 'civicrm_user_job'; |
| 25 | |
| 26 | /** |
| 27 | * Should CiviCRM log any modifications to this table in the civicrm_log table. |
| 28 | * |
| 29 | * @var bool |
| 30 | */ |
| 31 | public static $_log = FALSE; |
| 32 | |
| 33 | /** |
| 34 | * Job ID |
| 35 | * |
| 36 | * @var int|string|null |
| 37 | * (SQL type: int unsigned) |
| 38 | * Note that values will be retrieved from the database as a string. |
| 39 | */ |
| 40 | public $id; |
| 41 | |
| 42 | /** |
| 43 | * Unique name for job. |
| 44 | * |
| 45 | * @var string|null |
| 46 | * (SQL type: varchar(64)) |
| 47 | * Note that values will be retrieved from the database as a string. |
| 48 | */ |
| 49 | public $name; |
| 50 | |
| 51 | /** |
| 52 | * FK to contact table. |
| 53 | * |
| 54 | * @var int|string|null |
| 55 | * (SQL type: int unsigned) |
| 56 | * Note that values will be retrieved from the database as a string. |
| 57 | */ |
| 58 | public $created_id; |
| 59 | |
| 60 | /** |
| 61 | * Date and time this job was created. |
| 62 | * |
| 63 | * @var string |
| 64 | * (SQL type: timestamp) |
| 65 | * Note that values will be retrieved from the database as a string. |
| 66 | */ |
| 67 | public $created_date; |
| 68 | |
| 69 | /** |
| 70 | * Date and time this import job started. |
| 71 | * |
| 72 | * @var string |
| 73 | * (SQL type: timestamp) |
| 74 | * Note that values will be retrieved from the database as a string. |
| 75 | */ |
| 76 | public $start_date; |
| 77 | |
| 78 | /** |
| 79 | * Date and time this import job ended. |
| 80 | * |
| 81 | * @var string |
| 82 | * (SQL type: timestamp) |
| 83 | * Note that values will be retrieved from the database as a string. |
| 84 | */ |
| 85 | public $end_date; |
| 86 | |
| 87 | /** |
| 88 | * Date and time to clean up after this import job (temp table deletion date). |
| 89 | * |
| 90 | * @var string |
| 91 | * (SQL type: timestamp) |
| 92 | * Note that values will be retrieved from the database as a string. |
| 93 | */ |
| 94 | public $expires_date; |
| 95 | |
| 96 | /** |
| 97 | * @var int|string |
| 98 | * (SQL type: int unsigned) |
| 99 | * Note that values will be retrieved from the database as a string. |
| 100 | */ |
| 101 | public $status_id; |
| 102 | |
| 103 | /** |
| 104 | * @var int|string |
| 105 | * (SQL type: int unsigned) |
| 106 | * Note that values will be retrieved from the database as a string. |
| 107 | */ |
| 108 | public $type_id; |
| 109 | |
| 110 | /** |
| 111 | * FK to Queue |
| 112 | * |
| 113 | * @var int|string|null |
| 114 | * (SQL type: int unsigned) |
| 115 | * Note that values will be retrieved from the database as a string. |
| 116 | */ |
| 117 | public $queue_id; |
| 118 | |
| 119 | /** |
| 120 | * Data pertaining to job configuration |
| 121 | * |
| 122 | * @var string|null |
| 123 | * (SQL type: text) |
| 124 | * Note that values will be retrieved from the database as a string. |
| 125 | */ |
| 126 | public $metadata; |
| 127 | |
| 128 | /** |
| 129 | * Is this a template configuration (for use by other/future jobs)? |
| 130 | * |
| 131 | * @var bool|string |
| 132 | * (SQL type: tinyint) |
| 133 | * Note that values will be retrieved from the database as a string. |
| 134 | */ |
| 135 | public $is_template; |
| 136 | |
| 137 | /** |
| 138 | * Class constructor. |
| 139 | */ |
| 140 | public function __construct() { |
| 141 | $this->__table = 'civicrm_user_job'; |
| 142 | parent::__construct(); |
| 143 | } |
| 144 | |
| 145 | /** |
| 146 | * Returns localized title of this entity. |
| 147 | * |
| 148 | * @param bool $plural |
| 149 | * Whether to return the plural version of the title. |
| 150 | */ |
| 151 | public static function getEntityTitle($plural = FALSE) { |
| 152 | return $plural ? ts('User Jobs') : ts('User Job'); |
| 153 | } |
| 154 | |
| 155 | /** |
| 156 | * Returns foreign keys and entity references. |
| 157 | * |
| 158 | * @return array |
| 159 | * [CRM_Core_Reference_Interface] |
| 160 | */ |
| 161 | public static function getReferenceColumns() { |
| 162 | if (!isset(Civi::$statics[__CLASS__]['links'])) { |
| 163 | Civi::$statics[__CLASS__]['links'] = static::createReferenceColumns(__CLASS__); |
| 164 | Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'created_id', 'civicrm_contact', 'id'); |
| 165 | Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'queue_id', 'civicrm_queue', 'id'); |
| 166 | CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'links_callback', Civi::$statics[__CLASS__]['links']); |
| 167 | } |
| 168 | return Civi::$statics[__CLASS__]['links']; |
| 169 | } |
| 170 | |
| 171 | /** |
| 172 | * Returns all the column names of this table |
| 173 | * |
| 174 | * @return array |
| 175 | */ |
| 176 | public static function &fields() { |
| 177 | if (!isset(Civi::$statics[__CLASS__]['fields'])) { |
| 178 | Civi::$statics[__CLASS__]['fields'] = [ |
| 179 | 'id' => [ |
| 180 | 'name' => 'id', |
| 181 | 'type' => CRM_Utils_Type::T_INT, |
| 182 | 'title' => ts('User Job ID'), |
| 183 | 'description' => ts('Job ID'), |
| 184 | 'required' => TRUE, |
| 185 | 'where' => 'civicrm_user_job.id', |
| 186 | 'table_name' => 'civicrm_user_job', |
| 187 | 'entity' => 'UserJob', |
| 188 | 'bao' => 'CRM_Core_BAO_UserJob', |
| 189 | 'localizable' => 0, |
| 190 | 'html' => [ |
| 191 | 'type' => 'Number', |
| 192 | ], |
| 193 | 'readonly' => TRUE, |
| 194 | 'add' => '5.50', |
| 195 | ], |
| 196 | 'name' => [ |
| 197 | 'name' => 'name', |
| 198 | 'type' => CRM_Utils_Type::T_STRING, |
| 199 | 'title' => ts('User job name'), |
| 200 | 'description' => ts('Unique name for job.'), |
| 201 | 'maxlength' => 64, |
| 202 | 'size' => CRM_Utils_Type::BIG, |
| 203 | 'where' => 'civicrm_user_job.name', |
| 204 | 'table_name' => 'civicrm_user_job', |
| 205 | 'entity' => 'UserJob', |
| 206 | 'bao' => 'CRM_Core_BAO_UserJob', |
| 207 | 'localizable' => 0, |
| 208 | 'add' => '5.50', |
| 209 | ], |
| 210 | 'created_id' => [ |
| 211 | 'name' => 'created_id', |
| 212 | 'type' => CRM_Utils_Type::T_INT, |
| 213 | 'title' => ts('Created By Contact ID'), |
| 214 | 'description' => ts('FK to contact table.'), |
| 215 | 'where' => 'civicrm_user_job.created_id', |
| 216 | 'table_name' => 'civicrm_user_job', |
| 217 | 'entity' => 'UserJob', |
| 218 | 'bao' => 'CRM_Core_BAO_UserJob', |
| 219 | 'localizable' => 0, |
| 220 | 'FKClassName' => 'CRM_Contact_DAO_Contact', |
| 221 | 'html' => [ |
| 222 | 'label' => ts("Created By"), |
| 223 | ], |
| 224 | 'add' => '5.50', |
| 225 | ], |
| 226 | 'created_date' => [ |
| 227 | 'name' => 'created_date', |
| 228 | 'type' => CRM_Utils_Type::T_TIMESTAMP, |
| 229 | 'title' => ts('Import Job Created Date'), |
| 230 | 'description' => ts('Date and time this job was created.'), |
| 231 | 'required' => TRUE, |
| 232 | 'where' => 'civicrm_user_job.created_date', |
| 233 | 'default' => 'CURRENT_TIMESTAMP', |
| 234 | 'table_name' => 'civicrm_user_job', |
| 235 | 'entity' => 'UserJob', |
| 236 | 'bao' => 'CRM_Core_BAO_UserJob', |
| 237 | 'localizable' => 0, |
| 238 | 'html' => [ |
| 239 | 'type' => 'Select Date', |
| 240 | 'formatType' => 'activityDateTime', |
| 241 | ], |
| 242 | 'readonly' => TRUE, |
| 243 | 'add' => '5.50', |
| 244 | ], |
| 245 | 'start_date' => [ |
| 246 | 'name' => 'start_date', |
| 247 | 'type' => CRM_Utils_Type::T_TIMESTAMP, |
| 248 | 'title' => ts('Import Job Started Date'), |
| 249 | 'description' => ts('Date and time this import job started.'), |
| 250 | 'required' => FALSE, |
| 251 | 'where' => 'civicrm_user_job.start_date', |
| 252 | 'table_name' => 'civicrm_user_job', |
| 253 | 'entity' => 'UserJob', |
| 254 | 'bao' => 'CRM_Core_BAO_UserJob', |
| 255 | 'localizable' => 0, |
| 256 | 'html' => [ |
| 257 | 'type' => 'Select Date', |
| 258 | 'formatType' => 'activityDateTime', |
| 259 | ], |
| 260 | 'readonly' => TRUE, |
| 261 | 'add' => '5.50', |
| 262 | ], |
| 263 | 'end_date' => [ |
| 264 | 'name' => 'end_date', |
| 265 | 'type' => CRM_Utils_Type::T_TIMESTAMP, |
| 266 | 'title' => ts('Job Ended Date'), |
| 267 | 'description' => ts('Date and time this import job ended.'), |
| 268 | 'required' => FALSE, |
| 269 | 'where' => 'civicrm_user_job.end_date', |
| 270 | 'table_name' => 'civicrm_user_job', |
| 271 | 'entity' => 'UserJob', |
| 272 | 'bao' => 'CRM_Core_BAO_UserJob', |
| 273 | 'localizable' => 0, |
| 274 | 'html' => [ |
| 275 | 'type' => 'Select Date', |
| 276 | 'formatType' => 'activityDateTime', |
| 277 | ], |
| 278 | 'add' => '5.50', |
| 279 | ], |
| 280 | 'expires_date' => [ |
| 281 | 'name' => 'expires_date', |
| 282 | 'type' => CRM_Utils_Type::T_TIMESTAMP, |
| 283 | 'title' => ts('Import Job Expires Date'), |
| 284 | 'description' => ts('Date and time to clean up after this import job (temp table deletion date).'), |
| 285 | 'required' => FALSE, |
| 286 | 'where' => 'civicrm_user_job.expires_date', |
| 287 | 'table_name' => 'civicrm_user_job', |
| 288 | 'entity' => 'UserJob', |
| 289 | 'bao' => 'CRM_Core_BAO_UserJob', |
| 290 | 'localizable' => 0, |
| 291 | 'html' => [ |
| 292 | 'type' => 'Select Date', |
| 293 | 'formatType' => 'activityDateTime', |
| 294 | ], |
| 295 | 'add' => '5.50', |
| 296 | ], |
| 297 | 'status_id' => [ |
| 298 | 'name' => 'status_id', |
| 299 | 'type' => CRM_Utils_Type::T_INT, |
| 300 | 'title' => ts('User Job Status ID'), |
| 301 | 'required' => TRUE, |
| 302 | 'where' => 'civicrm_user_job.status_id', |
| 303 | 'table_name' => 'civicrm_user_job', |
| 304 | 'entity' => 'UserJob', |
| 305 | 'bao' => 'CRM_Core_BAO_UserJob', |
| 306 | 'localizable' => 0, |
| 307 | 'html' => [ |
| 308 | 'label' => ts("Job Status"), |
| 309 | ], |
| 310 | 'pseudoconstant' => [ |
| 311 | 'callback' => 'CRM_Core_BAO_UserJob::getStatuses', |
| 312 | ], |
| 313 | 'add' => '5.50', |
| 314 | ], |
| 315 | 'type_id' => [ |
| 316 | 'name' => 'type_id', |
| 317 | 'type' => CRM_Utils_Type::T_INT, |
| 318 | 'title' => ts('User Job Type ID'), |
| 319 | 'required' => TRUE, |
| 320 | 'where' => 'civicrm_user_job.type_id', |
| 321 | 'table_name' => 'civicrm_user_job', |
| 322 | 'entity' => 'UserJob', |
| 323 | 'bao' => 'CRM_Core_BAO_UserJob', |
| 324 | 'localizable' => 0, |
| 325 | 'html' => [ |
| 326 | 'label' => ts("Job Type"), |
| 327 | ], |
| 328 | 'pseudoconstant' => [ |
| 329 | 'callback' => 'CRM_Core_BAO_UserJob::getTypes', |
| 330 | ], |
| 331 | 'add' => '5.50', |
| 332 | ], |
| 333 | 'queue_id' => [ |
| 334 | 'name' => 'queue_id', |
| 335 | 'type' => CRM_Utils_Type::T_INT, |
| 336 | 'title' => ts('Queue ID'), |
| 337 | 'description' => ts('FK to Queue'), |
| 338 | 'where' => 'civicrm_user_job.queue_id', |
| 339 | 'table_name' => 'civicrm_user_job', |
| 340 | 'entity' => 'UserJob', |
| 341 | 'bao' => 'CRM_Core_BAO_UserJob', |
| 342 | 'localizable' => 0, |
| 343 | 'FKClassName' => 'CRM_Queue_DAO_Queue', |
| 344 | 'html' => [ |
| 345 | 'label' => ts("Queue"), |
| 346 | ], |
| 347 | 'add' => NULL, |
| 348 | ], |
| 349 | 'metadata' => [ |
| 350 | 'name' => 'metadata', |
| 351 | 'type' => CRM_Utils_Type::T_TEXT, |
| 352 | 'title' => ts('Job metadata'), |
| 353 | 'description' => ts('Data pertaining to job configuration'), |
| 354 | 'where' => 'civicrm_user_job.metadata', |
| 355 | 'table_name' => 'civicrm_user_job', |
| 356 | 'entity' => 'UserJob', |
| 357 | 'bao' => 'CRM_Core_BAO_UserJob', |
| 358 | 'localizable' => 0, |
| 359 | 'serialize' => self::SERIALIZE_JSON, |
| 360 | 'add' => '5.50', |
| 361 | ], |
| 362 | 'is_template' => [ |
| 363 | 'name' => 'is_template', |
| 364 | 'type' => CRM_Utils_Type::T_BOOLEAN, |
| 365 | 'title' => ts('Is Template'), |
| 366 | 'description' => ts('Is this a template configuration (for use by other/future jobs)?'), |
| 367 | 'required' => TRUE, |
| 368 | 'where' => 'civicrm_user_job.is_template', |
| 369 | 'default' => '0', |
| 370 | 'table_name' => 'civicrm_user_job', |
| 371 | 'entity' => 'UserJob', |
| 372 | 'bao' => 'CRM_Core_BAO_UserJob', |
| 373 | 'localizable' => 0, |
| 374 | 'html' => [ |
| 375 | 'type' => 'CheckBox', |
| 376 | 'label' => ts("Is Template"), |
| 377 | ], |
| 378 | 'add' => '5.51', |
| 379 | ], |
| 380 | ]; |
| 381 | CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']); |
| 382 | } |
| 383 | return Civi::$statics[__CLASS__]['fields']; |
| 384 | } |
| 385 | |
| 386 | /** |
| 387 | * Return a mapping from field-name to the corresponding key (as used in fields()). |
| 388 | * |
| 389 | * @return array |
| 390 | * Array(string $name => string $uniqueName). |
| 391 | */ |
| 392 | public static function &fieldKeys() { |
| 393 | if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) { |
| 394 | Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields())); |
| 395 | } |
| 396 | return Civi::$statics[__CLASS__]['fieldKeys']; |
| 397 | } |
| 398 | |
| 399 | /** |
| 400 | * Returns the names of this table |
| 401 | * |
| 402 | * @return string |
| 403 | */ |
| 404 | public static function getTableName() { |
| 405 | return self::$_tableName; |
| 406 | } |
| 407 | |
| 408 | /** |
| 409 | * Returns if this table needs to be logged |
| 410 | * |
| 411 | * @return bool |
| 412 | */ |
| 413 | public function getLog() { |
| 414 | return self::$_log; |
| 415 | } |
| 416 | |
| 417 | /** |
| 418 | * Returns the list of fields that can be imported |
| 419 | * |
| 420 | * @param bool $prefix |
| 421 | * |
| 422 | * @return array |
| 423 | */ |
| 424 | public static function &import($prefix = FALSE) { |
| 425 | $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'user_job', $prefix, []); |
| 426 | return $r; |
| 427 | } |
| 428 | |
| 429 | /** |
| 430 | * Returns the list of fields that can be exported |
| 431 | * |
| 432 | * @param bool $prefix |
| 433 | * |
| 434 | * @return array |
| 435 | */ |
| 436 | public static function &export($prefix = FALSE) { |
| 437 | $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'user_job', $prefix, []); |
| 438 | return $r; |
| 439 | } |
| 440 | |
| 441 | /** |
| 442 | * Returns the list of indices |
| 443 | * |
| 444 | * @param bool $localize |
| 445 | * |
| 446 | * @return array |
| 447 | */ |
| 448 | public static function indices($localize = TRUE) { |
| 449 | $indices = [ |
| 450 | 'UI_name' => [ |
| 451 | 'name' => 'UI_name', |
| 452 | 'field' => [ |
| 453 | 0 => 'name', |
| 454 | ], |
| 455 | 'localizable' => FALSE, |
| 456 | 'unique' => TRUE, |
| 457 | 'sig' => 'civicrm_user_job::1::name', |
| 458 | ], |
| 459 | ]; |
| 460 | return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices; |
| 461 | } |
| 462 | |
| 463 | } |