| 1 | <?php |
| 2 | |
| 3 | /** |
| 4 | * @package CRM |
| 5 | * @copyright CiviCRM LLC (c) 2004-2018 |
| 6 | * |
| 7 | * Generated from xml/schema/CRM/Core/JobLog.xml |
| 8 | * DO NOT EDIT. Generated by CRM_Core_CodeGen |
| 9 | * (GenCodeChecksum:68e8b90d050e64feef2b1868d83a7923) |
| 10 | */ |
| 11 | |
| 12 | /** |
| 13 | * Database access object for the JobLog entity. |
| 14 | */ |
| 15 | class CRM_Core_DAO_JobLog extends CRM_Core_DAO { |
| 16 | |
| 17 | /** |
| 18 | * Static instance to hold the table name. |
| 19 | * |
| 20 | * @var string |
| 21 | */ |
| 22 | static $_tableName = 'civicrm_job_log'; |
| 23 | |
| 24 | /** |
| 25 | * Should CiviCRM log any modifications to this table in the civicrm_log table. |
| 26 | * |
| 27 | * @var bool |
| 28 | */ |
| 29 | static $_log = FALSE; |
| 30 | |
| 31 | /** |
| 32 | * Job log entry Id |
| 33 | * |
| 34 | * @var int unsigned |
| 35 | */ |
| 36 | public $id; |
| 37 | |
| 38 | /** |
| 39 | * Which Domain is this scheduled job for |
| 40 | * |
| 41 | * @var int unsigned |
| 42 | */ |
| 43 | public $domain_id; |
| 44 | |
| 45 | /** |
| 46 | * Log entry date |
| 47 | * |
| 48 | * @var timestamp |
| 49 | */ |
| 50 | public $run_time; |
| 51 | |
| 52 | /** |
| 53 | * Pointer to job id - not a FK though, just for logging purposes |
| 54 | * |
| 55 | * @var int unsigned |
| 56 | */ |
| 57 | public $job_id; |
| 58 | |
| 59 | /** |
| 60 | * Title of the job |
| 61 | * |
| 62 | * @var string |
| 63 | */ |
| 64 | public $name; |
| 65 | |
| 66 | /** |
| 67 | * Full path to file containing job script |
| 68 | * |
| 69 | * @var string |
| 70 | */ |
| 71 | public $command; |
| 72 | |
| 73 | /** |
| 74 | * Title line of log entry |
| 75 | * |
| 76 | * @var string |
| 77 | */ |
| 78 | public $description; |
| 79 | |
| 80 | /** |
| 81 | * Potential extended data for specific job run (e.g. tracebacks). |
| 82 | * |
| 83 | * @var text |
| 84 | */ |
| 85 | public $data; |
| 86 | |
| 87 | /** |
| 88 | * Class constructor. |
| 89 | */ |
| 90 | public function __construct() { |
| 91 | $this->__table = 'civicrm_job_log'; |
| 92 | parent::__construct(); |
| 93 | } |
| 94 | |
| 95 | /** |
| 96 | * Returns foreign keys and entity references. |
| 97 | * |
| 98 | * @return array |
| 99 | * [CRM_Core_Reference_Interface] |
| 100 | */ |
| 101 | public static function getReferenceColumns() { |
| 102 | if (!isset(Civi::$statics[__CLASS__]['links'])) { |
| 103 | Civi::$statics[__CLASS__]['links'] = static ::createReferenceColumns(__CLASS__); |
| 104 | Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'domain_id', 'civicrm_domain', 'id'); |
| 105 | CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'links_callback', Civi::$statics[__CLASS__]['links']); |
| 106 | } |
| 107 | return Civi::$statics[__CLASS__]['links']; |
| 108 | } |
| 109 | |
| 110 | /** |
| 111 | * Returns all the column names of this table |
| 112 | * |
| 113 | * @return array |
| 114 | */ |
| 115 | public static function &fields() { |
| 116 | if (!isset(Civi::$statics[__CLASS__]['fields'])) { |
| 117 | Civi::$statics[__CLASS__]['fields'] = [ |
| 118 | 'id' => [ |
| 119 | 'name' => 'id', |
| 120 | 'type' => CRM_Utils_Type::T_INT, |
| 121 | 'title' => ts('Job Log ID'), |
| 122 | 'description' => ts('Job log entry Id'), |
| 123 | 'required' => TRUE, |
| 124 | 'table_name' => 'civicrm_job_log', |
| 125 | 'entity' => 'JobLog', |
| 126 | 'bao' => 'CRM_Core_DAO_JobLog', |
| 127 | 'localizable' => 0, |
| 128 | ], |
| 129 | 'domain_id' => [ |
| 130 | 'name' => 'domain_id', |
| 131 | 'type' => CRM_Utils_Type::T_INT, |
| 132 | 'title' => ts('Domain ID'), |
| 133 | 'description' => ts('Which Domain is this scheduled job for'), |
| 134 | 'required' => TRUE, |
| 135 | 'table_name' => 'civicrm_job_log', |
| 136 | 'entity' => 'JobLog', |
| 137 | 'bao' => 'CRM_Core_DAO_JobLog', |
| 138 | 'localizable' => 0, |
| 139 | 'FKClassName' => 'CRM_Core_DAO_Domain', |
| 140 | 'pseudoconstant' => [ |
| 141 | 'table' => 'civicrm_domain', |
| 142 | 'keyColumn' => 'id', |
| 143 | 'labelColumn' => 'name', |
| 144 | ] |
| 145 | ], |
| 146 | 'run_time' => [ |
| 147 | 'name' => 'run_time', |
| 148 | 'type' => CRM_Utils_Type::T_TIMESTAMP, |
| 149 | 'title' => ts('Timestamp'), |
| 150 | 'description' => ts('Log entry date'), |
| 151 | 'table_name' => 'civicrm_job_log', |
| 152 | 'entity' => 'JobLog', |
| 153 | 'bao' => 'CRM_Core_DAO_JobLog', |
| 154 | 'localizable' => 0, |
| 155 | ], |
| 156 | 'job_id' => [ |
| 157 | 'name' => 'job_id', |
| 158 | 'type' => CRM_Utils_Type::T_INT, |
| 159 | 'title' => ts('Job ID'), |
| 160 | 'description' => ts('Pointer to job id - not a FK though, just for logging purposes'), |
| 161 | 'table_name' => 'civicrm_job_log', |
| 162 | 'entity' => 'JobLog', |
| 163 | 'bao' => 'CRM_Core_DAO_JobLog', |
| 164 | 'localizable' => 0, |
| 165 | ], |
| 166 | 'name' => [ |
| 167 | 'name' => 'name', |
| 168 | 'type' => CRM_Utils_Type::T_STRING, |
| 169 | 'title' => ts('Job Name'), |
| 170 | 'description' => ts('Title of the job'), |
| 171 | 'maxlength' => 255, |
| 172 | 'size' => CRM_Utils_Type::HUGE, |
| 173 | 'table_name' => 'civicrm_job_log', |
| 174 | 'entity' => 'JobLog', |
| 175 | 'bao' => 'CRM_Core_DAO_JobLog', |
| 176 | 'localizable' => 0, |
| 177 | ], |
| 178 | 'command' => [ |
| 179 | 'name' => 'command', |
| 180 | 'type' => CRM_Utils_Type::T_STRING, |
| 181 | 'title' => ts('Command'), |
| 182 | 'description' => ts('Full path to file containing job script'), |
| 183 | 'maxlength' => 255, |
| 184 | 'size' => CRM_Utils_Type::HUGE, |
| 185 | 'table_name' => 'civicrm_job_log', |
| 186 | 'entity' => 'JobLog', |
| 187 | 'bao' => 'CRM_Core_DAO_JobLog', |
| 188 | 'localizable' => 0, |
| 189 | ], |
| 190 | 'description' => [ |
| 191 | 'name' => 'description', |
| 192 | 'type' => CRM_Utils_Type::T_STRING, |
| 193 | 'title' => ts('Description'), |
| 194 | 'description' => ts('Title line of log entry'), |
| 195 | 'maxlength' => 255, |
| 196 | 'size' => CRM_Utils_Type::HUGE, |
| 197 | 'table_name' => 'civicrm_job_log', |
| 198 | 'entity' => 'JobLog', |
| 199 | 'bao' => 'CRM_Core_DAO_JobLog', |
| 200 | 'localizable' => 0, |
| 201 | ], |
| 202 | 'data' => [ |
| 203 | 'name' => 'data', |
| 204 | 'type' => CRM_Utils_Type::T_TEXT, |
| 205 | 'title' => ts('Extended Data'), |
| 206 | 'description' => ts('Potential extended data for specific job run (e.g. tracebacks).'), |
| 207 | 'table_name' => 'civicrm_job_log', |
| 208 | 'entity' => 'JobLog', |
| 209 | 'bao' => 'CRM_Core_DAO_JobLog', |
| 210 | 'localizable' => 0, |
| 211 | ], |
| 212 | ]; |
| 213 | CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']); |
| 214 | } |
| 215 | return Civi::$statics[__CLASS__]['fields']; |
| 216 | } |
| 217 | |
| 218 | /** |
| 219 | * Return a mapping from field-name to the corresponding key (as used in fields()). |
| 220 | * |
| 221 | * @return array |
| 222 | * Array(string $name => string $uniqueName). |
| 223 | */ |
| 224 | public static function &fieldKeys() { |
| 225 | if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) { |
| 226 | Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields())); |
| 227 | } |
| 228 | return Civi::$statics[__CLASS__]['fieldKeys']; |
| 229 | } |
| 230 | |
| 231 | /** |
| 232 | * Returns the names of this table |
| 233 | * |
| 234 | * @return string |
| 235 | */ |
| 236 | public static function getTableName() { |
| 237 | return self::$_tableName; |
| 238 | } |
| 239 | |
| 240 | /** |
| 241 | * Returns if this table needs to be logged |
| 242 | * |
| 243 | * @return bool |
| 244 | */ |
| 245 | public function getLog() { |
| 246 | return self::$_log; |
| 247 | } |
| 248 | |
| 249 | /** |
| 250 | * Returns the list of fields that can be imported |
| 251 | * |
| 252 | * @param bool $prefix |
| 253 | * |
| 254 | * @return array |
| 255 | */ |
| 256 | public static function &import($prefix = FALSE) { |
| 257 | $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'job_log', $prefix, []); |
| 258 | return $r; |
| 259 | } |
| 260 | |
| 261 | /** |
| 262 | * Returns the list of fields that can be exported |
| 263 | * |
| 264 | * @param bool $prefix |
| 265 | * |
| 266 | * @return array |
| 267 | */ |
| 268 | public static function &export($prefix = FALSE) { |
| 269 | $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'job_log', $prefix, []); |
| 270 | return $r; |
| 271 | } |
| 272 | |
| 273 | /** |
| 274 | * Returns the list of indices |
| 275 | * |
| 276 | * @param bool $localize |
| 277 | * |
| 278 | * @return array |
| 279 | */ |
| 280 | public static function indices($localize = TRUE) { |
| 281 | $indices = []; |
| 282 | return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices; |
| 283 | } |
| 284 | |
| 285 | } |