Merge pull request #22587 from colemanw/apiNull
[civicrm-core.git] / CRM / Queue / DAO / QueueItem.php
CommitLineData
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/Queue/QueueItem.xml
8 * DO NOT EDIT. Generated by CRM_Core_CodeGen
28979d65 9 * (GenCodeChecksum:36871610524adb64bc8aa3bb24b295f4)
e501603b 10 */
c3fc2621 11
f41f0342 12/**
c3fc2621 13 * Database access object for the QueueItem entity.
f41f0342 14 */
e501603b 15class CRM_Queue_DAO_QueueItem extends CRM_Core_DAO {
929a1c14
CW
16 const EXT = 'civicrm';
17 const TABLE_ADDED = '4.2';
c3fc2621 18
e501603b 19 /**
f41f0342 20 * Static instance to hold the table name.
e501603b
TO
21 *
22 * @var string
23 */
fa45b5b9 24 public static $_tableName = 'civicrm_queue_item';
c3fc2621 25
e501603b 26 /**
f41f0342 27 * Should CiviCRM log any modifications to this table in the civicrm_log table.
e501603b 28 *
c3fc2621 29 * @var bool
e501603b 30 */
fa45b5b9 31 public static $_log = FALSE;
c3fc2621 32
e501603b 33 /**
28979d65
CW
34 * @var int|string|null
35 * (SQL type: int unsigned)
36 * Note that values will be retrieved from the database as a string.
e501603b
TO
37 */
38 public $id;
c3fc2621 39
e501603b
TO
40 /**
41 * Name of the queue which includes this item
42 *
43 * @var string
28979d65
CW
44 * (SQL type: varchar(64))
45 * Note that values will be retrieved from the database as a string.
e501603b
TO
46 */
47 public $queue_name;
c3fc2621 48
e501603b 49 /**
28979d65
CW
50 * @var int|string
51 * (SQL type: int)
52 * Note that values will be retrieved from the database as a string.
e501603b
TO
53 */
54 public $weight;
c3fc2621 55
e501603b
TO
56 /**
57 * date on which this item was submitted to the queue
58 *
28979d65
CW
59 * @var string
60 * (SQL type: datetime)
61 * Note that values will be retrieved from the database as a string.
e501603b
TO
62 */
63 public $submit_time;
c3fc2621 64
e501603b
TO
65 /**
66 * date on which this job becomes available; null if ASAP
67 *
28979d65
CW
68 * @var string|null
69 * (SQL type: datetime)
70 * Note that values will be retrieved from the database as a string.
e501603b
TO
71 */
72 public $release_time;
c3fc2621 73
e501603b 74 /**
2a5c9b4d 75 * Serialized queue data
e501603b 76 *
28979d65
CW
77 * @var string|null
78 * (SQL type: longtext)
79 * Note that values will be retrieved from the database as a string.
e501603b
TO
80 */
81 public $data;
c3fc2621 82
e501603b 83 /**
f41f0342 84 * Class constructor.
e501603b 85 */
c3fc2621 86 public function __construct() {
e501603b
TO
87 $this->__table = 'civicrm_queue_item';
88 parent::__construct();
89 }
c3fc2621 90
449c4e6b
CW
91 /**
92 * Returns localized title of this entity.
7b66c3b5
AH
93 *
94 * @param bool $plural
95 * Whether to return the plural version of the title.
449c4e6b 96 */
7b66c3b5
AH
97 public static function getEntityTitle($plural = FALSE) {
98 return $plural ? ts('Queue Items') : ts('Queue Item');
449c4e6b
CW
99 }
100
e501603b
TO
101 /**
102 * Returns all the column names of this table
103 *
104 * @return array
105 */
c3fc2621 106 public static function &fields() {
346aaaba 107 if (!isset(Civi::$statics[__CLASS__]['fields'])) {
c3fc2621
CW
108 Civi::$statics[__CLASS__]['fields'] = [
109 'id' => [
e501603b
TO
110 'name' => 'id',
111 'type' => CRM_Utils_Type::T_INT,
f4038db9 112 'title' => ts('Queue Item ID'),
c3fc2621 113 'required' => TRUE,
a36434b9 114 'where' => 'civicrm_queue_item.id',
522a26c9 115 'table_name' => 'civicrm_queue_item',
116 'entity' => 'QueueItem',
117 'bao' => 'CRM_Queue_BAO_QueueItem',
6a7e5e5d 118 'localizable' => 0,
2cbbebe8
A
119 'html' => [
120 'type' => 'Number',
121 ],
1fe423d6 122 'readonly' => TRUE,
a9d0587b 123 'add' => NULL,
c3fc2621
CW
124 ],
125 'queue_name' => [
e501603b
TO
126 'name' => 'queue_name',
127 'type' => CRM_Utils_Type::T_STRING,
c3fc2621 128 'title' => ts('Queue Name'),
215b423e 129 'description' => ts('Name of the queue which includes this item'),
c3fc2621 130 'required' => TRUE,
e501603b
TO
131 'maxlength' => 64,
132 'size' => CRM_Utils_Type::BIG,
a36434b9 133 'where' => 'civicrm_queue_item.queue_name',
522a26c9 134 'table_name' => 'civicrm_queue_item',
135 'entity' => 'QueueItem',
136 'bao' => 'CRM_Queue_BAO_QueueItem',
6a7e5e5d 137 'localizable' => 0,
c3fc2621 138 'html' => [
e501603b 139 'type' => 'Text',
c3fc2621 140 ],
a9d0587b 141 'add' => NULL,
c3fc2621
CW
142 ],
143 'weight' => [
e501603b
TO
144 'name' => 'weight',
145 'type' => CRM_Utils_Type::T_INT,
c3fc2621
CW
146 'title' => ts('Order'),
147 'required' => TRUE,
a36434b9 148 'where' => 'civicrm_queue_item.weight',
522a26c9 149 'table_name' => 'civicrm_queue_item',
150 'entity' => 'QueueItem',
151 'bao' => 'CRM_Queue_BAO_QueueItem',
6a7e5e5d 152 'localizable' => 0,
c3fc2621 153 'html' => [
e501603b 154 'type' => 'Text',
c3fc2621 155 ],
a9d0587b 156 'add' => NULL,
c3fc2621
CW
157 ],
158 'submit_time' => [
e501603b
TO
159 'name' => 'submit_time',
160 'type' => CRM_Utils_Type::T_DATE + CRM_Utils_Type::T_TIME,
c3fc2621 161 'title' => ts('Submit Time'),
215b423e 162 'description' => ts('date on which this item was submitted to the queue'),
c3fc2621 163 'required' => TRUE,
a36434b9 164 'where' => 'civicrm_queue_item.submit_time',
522a26c9 165 'table_name' => 'civicrm_queue_item',
166 'entity' => 'QueueItem',
167 'bao' => 'CRM_Queue_BAO_QueueItem',
6a7e5e5d 168 'localizable' => 0,
c3fc2621 169 'html' => [
e501603b 170 'type' => 'Select Date',
efcda6b9 171 'formatType' => 'activityDateTime',
c3fc2621 172 ],
a9d0587b 173 'add' => NULL,
c3fc2621
CW
174 ],
175 'release_time' => [
e501603b
TO
176 'name' => 'release_time',
177 'type' => CRM_Utils_Type::T_DATE + CRM_Utils_Type::T_TIME,
c3fc2621 178 'title' => ts('Release Time'),
215b423e 179 'description' => ts('date on which this job becomes available; null if ASAP'),
a36434b9 180 'where' => 'civicrm_queue_item.release_time',
522a26c9 181 'table_name' => 'civicrm_queue_item',
182 'entity' => 'QueueItem',
183 'bao' => 'CRM_Queue_BAO_QueueItem',
6a7e5e5d 184 'localizable' => 0,
c3fc2621 185 'html' => [
e501603b 186 'type' => 'Select Date',
efcda6b9 187 'formatType' => 'activityDateTime',
c3fc2621 188 ],
a9d0587b 189 'add' => NULL,
c3fc2621
CW
190 ],
191 'data' => [
e501603b 192 'name' => 'data',
e39a7c67 193 'type' => CRM_Utils_Type::T_LONGTEXT,
c3fc2621 194 'title' => ts('Queue item data'),
215b423e 195 'description' => ts('Serialized queue data'),
a36434b9 196 'where' => 'civicrm_queue_item.data',
522a26c9 197 'table_name' => 'civicrm_queue_item',
198 'entity' => 'QueueItem',
199 'bao' => 'CRM_Queue_BAO_QueueItem',
6a7e5e5d 200 'localizable' => 0,
2a5c9b4d 201 'serialize' => self::SERIALIZE_PHP,
a9d0587b 202 'add' => NULL,
c3fc2621
CW
203 ],
204 ];
346aaaba 205 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']);
e501603b 206 }
346aaaba 207 return Civi::$statics[__CLASS__]['fields'];
e501603b 208 }
c3fc2621 209
e501603b 210 /**
bd8e0b14 211 * Return a mapping from field-name to the corresponding key (as used in fields()).
e501603b
TO
212 *
213 * @return array
bd8e0b14 214 * Array(string $name => string $uniqueName).
e501603b 215 */
c3fc2621 216 public static function &fieldKeys() {
bd8e0b14
TO
217 if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) {
218 Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields()));
e501603b 219 }
bd8e0b14 220 return Civi::$statics[__CLASS__]['fieldKeys'];
e501603b 221 }
c3fc2621 222
e501603b
TO
223 /**
224 * Returns the names of this table
225 *
226 * @return string
227 */
c3fc2621 228 public static function getTableName() {
e501603b
TO
229 return self::$_tableName;
230 }
c3fc2621 231
e501603b
TO
232 /**
233 * Returns if this table needs to be logged
234 *
c3fc2621 235 * @return bool
e501603b 236 */
c3fc2621 237 public function getLog() {
e501603b
TO
238 return self::$_log;
239 }
c3fc2621 240
e501603b
TO
241 /**
242 * Returns the list of fields that can be imported
243 *
244 * @param bool $prefix
245 *
246 * @return array
247 */
c3fc2621
CW
248 public static function &import($prefix = FALSE) {
249 $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'queue_item', $prefix, []);
60808919 250 return $r;
e501603b 251 }
c3fc2621 252
e501603b
TO
253 /**
254 * Returns the list of fields that can be exported
255 *
256 * @param bool $prefix
257 *
258 * @return array
259 */
c3fc2621
CW
260 public static function &export($prefix = FALSE) {
261 $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'queue_item', $prefix, []);
60808919 262 return $r;
e501603b 263 }
c3fc2621 264
e7a6b91a
AS
265 /**
266 * Returns the list of indices
c3fc2621
CW
267 *
268 * @param bool $localize
269 *
270 * @return array
e7a6b91a
AS
271 */
272 public static function indices($localize = TRUE) {
c3fc2621
CW
273 $indices = [
274 'index_queueids' => [
e7a6b91a 275 'name' => 'index_queueids',
c3fc2621 276 'field' => [
e7a6b91a
AS
277 0 => 'queue_name',
278 1 => 'weight',
279 2 => 'id',
c3fc2621
CW
280 ],
281 'localizable' => FALSE,
e7a6b91a 282 'sig' => 'civicrm_queue_item::0::queue_name::weight::id',
c3fc2621
CW
283 ],
284 ];
e7a6b91a
AS
285 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices;
286 }
c3fc2621 287
e501603b 288}