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