API/DAO Metadata - Retain versioning metadata for possible usage in runtime+tooling
[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
a9d0587b 9 * (GenCodeChecksum:137a0dea273fd4cad666fc1091fc8c84)
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 {
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_queue_item';
c3fc2621 23
e501603b 24 /**
f41f0342 25 * Should CiviCRM log any modifications to this table in the civicrm_log table.
e501603b 26 *
c3fc2621 27 * @var bool
e501603b 28 */
fa45b5b9 29 public static $_log = FALSE;
c3fc2621 30
e501603b 31 /**
e6ca0a57 32 * @var int
e501603b
TO
33 */
34 public $id;
c3fc2621 35
e501603b
TO
36 /**
37 * Name of the queue which includes this item
38 *
39 * @var string
40 */
41 public $queue_name;
c3fc2621 42
e501603b 43 /**
e501603b
TO
44 * @var int
45 */
46 public $weight;
c3fc2621 47
e501603b
TO
48 /**
49 * date on which this item was submitted to the queue
50 *
51 * @var datetime
52 */
53 public $submit_time;
c3fc2621 54
e501603b
TO
55 /**
56 * date on which this job becomes available; null if ASAP
57 *
58 * @var datetime
59 */
60 public $release_time;
c3fc2621 61
e501603b 62 /**
2a5c9b4d 63 * Serialized queue data
e501603b
TO
64 *
65 * @var text
66 */
67 public $data;
c3fc2621 68
e501603b 69 /**
f41f0342 70 * Class constructor.
e501603b 71 */
c3fc2621 72 public function __construct() {
e501603b
TO
73 $this->__table = 'civicrm_queue_item';
74 parent::__construct();
75 }
c3fc2621 76
449c4e6b
CW
77 /**
78 * Returns localized title of this entity.
79 */
80 public static function getEntityTitle() {
81 return ts('Queue Items');
82 }
83
e501603b
TO
84 /**
85 * Returns all the column names of this table
86 *
87 * @return array
88 */
c3fc2621 89 public static function &fields() {
346aaaba 90 if (!isset(Civi::$statics[__CLASS__]['fields'])) {
c3fc2621
CW
91 Civi::$statics[__CLASS__]['fields'] = [
92 'id' => [
e501603b
TO
93 'name' => 'id',
94 'type' => CRM_Utils_Type::T_INT,
c3fc2621
CW
95 'title' => ts('Queue ID'),
96 'required' => TRUE,
a36434b9 97 'where' => 'civicrm_queue_item.id',
522a26c9 98 'table_name' => 'civicrm_queue_item',
99 'entity' => 'QueueItem',
100 'bao' => 'CRM_Queue_BAO_QueueItem',
6a7e5e5d 101 'localizable' => 0,
a9d0587b 102 'add' => NULL,
c3fc2621
CW
103 ],
104 'queue_name' => [
e501603b
TO
105 'name' => 'queue_name',
106 'type' => CRM_Utils_Type::T_STRING,
c3fc2621 107 'title' => ts('Queue Name'),
215b423e 108 'description' => ts('Name of the queue which includes this item'),
c3fc2621 109 'required' => TRUE,
e501603b
TO
110 'maxlength' => 64,
111 'size' => CRM_Utils_Type::BIG,
a36434b9 112 'where' => 'civicrm_queue_item.queue_name',
522a26c9 113 'table_name' => 'civicrm_queue_item',
114 'entity' => 'QueueItem',
115 'bao' => 'CRM_Queue_BAO_QueueItem',
6a7e5e5d 116 'localizable' => 0,
c3fc2621 117 'html' => [
e501603b 118 'type' => 'Text',
c3fc2621 119 ],
a9d0587b 120 'add' => NULL,
c3fc2621
CW
121 ],
122 'weight' => [
e501603b
TO
123 'name' => 'weight',
124 'type' => CRM_Utils_Type::T_INT,
c3fc2621
CW
125 'title' => ts('Order'),
126 'required' => TRUE,
a36434b9 127 'where' => 'civicrm_queue_item.weight',
522a26c9 128 'table_name' => 'civicrm_queue_item',
129 'entity' => 'QueueItem',
130 'bao' => 'CRM_Queue_BAO_QueueItem',
6a7e5e5d 131 'localizable' => 0,
c3fc2621 132 'html' => [
e501603b 133 'type' => 'Text',
c3fc2621 134 ],
a9d0587b 135 'add' => NULL,
c3fc2621
CW
136 ],
137 'submit_time' => [
e501603b
TO
138 'name' => 'submit_time',
139 'type' => CRM_Utils_Type::T_DATE + CRM_Utils_Type::T_TIME,
c3fc2621 140 'title' => ts('Submit Time'),
215b423e 141 'description' => ts('date on which this item was submitted to the queue'),
c3fc2621 142 'required' => TRUE,
a36434b9 143 'where' => 'civicrm_queue_item.submit_time',
522a26c9 144 'table_name' => 'civicrm_queue_item',
145 'entity' => 'QueueItem',
146 'bao' => 'CRM_Queue_BAO_QueueItem',
6a7e5e5d 147 'localizable' => 0,
c3fc2621 148 'html' => [
e501603b 149 'type' => 'Select Date',
c3fc2621 150 ],
a9d0587b 151 'add' => NULL,
c3fc2621
CW
152 ],
153 'release_time' => [
e501603b
TO
154 'name' => 'release_time',
155 'type' => CRM_Utils_Type::T_DATE + CRM_Utils_Type::T_TIME,
c3fc2621 156 'title' => ts('Release Time'),
215b423e 157 'description' => ts('date on which this job becomes available; null if ASAP'),
a36434b9 158 'where' => 'civicrm_queue_item.release_time',
522a26c9 159 'table_name' => 'civicrm_queue_item',
160 'entity' => 'QueueItem',
161 'bao' => 'CRM_Queue_BAO_QueueItem',
6a7e5e5d 162 'localizable' => 0,
c3fc2621 163 'html' => [
e501603b 164 'type' => 'Select Date',
c3fc2621 165 ],
a9d0587b 166 'add' => NULL,
c3fc2621
CW
167 ],
168 'data' => [
e501603b
TO
169 'name' => 'data',
170 'type' => CRM_Utils_Type::T_TEXT,
c3fc2621 171 'title' => ts('Queue item data'),
215b423e 172 'description' => ts('Serialized queue data'),
a36434b9 173 'where' => 'civicrm_queue_item.data',
522a26c9 174 'table_name' => 'civicrm_queue_item',
175 'entity' => 'QueueItem',
176 'bao' => 'CRM_Queue_BAO_QueueItem',
6a7e5e5d 177 'localizable' => 0,
2a5c9b4d 178 'serialize' => self::SERIALIZE_PHP,
a9d0587b 179 'add' => NULL,
c3fc2621
CW
180 ],
181 ];
346aaaba 182 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']);
e501603b 183 }
346aaaba 184 return Civi::$statics[__CLASS__]['fields'];
e501603b 185 }
c3fc2621 186
e501603b 187 /**
bd8e0b14 188 * Return a mapping from field-name to the corresponding key (as used in fields()).
e501603b
TO
189 *
190 * @return array
bd8e0b14 191 * Array(string $name => string $uniqueName).
e501603b 192 */
c3fc2621 193 public static function &fieldKeys() {
bd8e0b14
TO
194 if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) {
195 Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields()));
e501603b 196 }
bd8e0b14 197 return Civi::$statics[__CLASS__]['fieldKeys'];
e501603b 198 }
c3fc2621 199
e501603b
TO
200 /**
201 * Returns the names of this table
202 *
203 * @return string
204 */
c3fc2621 205 public static function getTableName() {
e501603b
TO
206 return self::$_tableName;
207 }
c3fc2621 208
e501603b
TO
209 /**
210 * Returns if this table needs to be logged
211 *
c3fc2621 212 * @return bool
e501603b 213 */
c3fc2621 214 public function getLog() {
e501603b
TO
215 return self::$_log;
216 }
c3fc2621 217
e501603b
TO
218 /**
219 * Returns the list of fields that can be imported
220 *
221 * @param bool $prefix
222 *
223 * @return array
224 */
c3fc2621
CW
225 public static function &import($prefix = FALSE) {
226 $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'queue_item', $prefix, []);
60808919 227 return $r;
e501603b 228 }
c3fc2621 229
e501603b
TO
230 /**
231 * Returns the list of fields that can be exported
232 *
233 * @param bool $prefix
234 *
235 * @return array
236 */
c3fc2621
CW
237 public static function &export($prefix = FALSE) {
238 $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'queue_item', $prefix, []);
60808919 239 return $r;
e501603b 240 }
c3fc2621 241
e7a6b91a
AS
242 /**
243 * Returns the list of indices
c3fc2621
CW
244 *
245 * @param bool $localize
246 *
247 * @return array
e7a6b91a
AS
248 */
249 public static function indices($localize = TRUE) {
c3fc2621
CW
250 $indices = [
251 'index_queueids' => [
e7a6b91a 252 'name' => 'index_queueids',
c3fc2621 253 'field' => [
e7a6b91a
AS
254 0 => 'queue_name',
255 1 => 'weight',
256 2 => 'id',
c3fc2621
CW
257 ],
258 'localizable' => FALSE,
e7a6b91a 259 'sig' => 'civicrm_queue_item::0::queue_name::weight::id',
c3fc2621
CW
260 ],
261 ];
e7a6b91a
AS
262 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices;
263 }
c3fc2621 264
e501603b 265}