Merge pull request #14356 from civicrm/5.14
[civicrm-core.git] / CRM / Queue / DAO / QueueItem.php
CommitLineData
e501603b 1<?php
c3fc2621 2
e501603b
TO
3/**
4 * @package CRM
6b83d5bd 5 * @copyright CiviCRM LLC (c) 2004-2019
e501603b
TO
6 *
7 * Generated from xml/schema/CRM/Queue/QueueItem.xml
8 * DO NOT EDIT. Generated by CRM_Core_CodeGen
e6ca0a57 9 * (GenCodeChecksum:375c90f10f805de0cc712cad771cf15e)
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
e501603b
TO
77 /**
78 * Returns all the column names of this table
79 *
80 * @return array
81 */
c3fc2621 82 public static function &fields() {
346aaaba 83 if (!isset(Civi::$statics[__CLASS__]['fields'])) {
c3fc2621
CW
84 Civi::$statics[__CLASS__]['fields'] = [
85 'id' => [
e501603b
TO
86 'name' => 'id',
87 'type' => CRM_Utils_Type::T_INT,
c3fc2621
CW
88 'title' => ts('Queue ID'),
89 'required' => TRUE,
a36434b9 90 'where' => 'civicrm_queue_item.id',
522a26c9 91 'table_name' => 'civicrm_queue_item',
92 'entity' => 'QueueItem',
93 'bao' => 'CRM_Queue_BAO_QueueItem',
6a7e5e5d 94 'localizable' => 0,
c3fc2621
CW
95 ],
96 'queue_name' => [
e501603b
TO
97 'name' => 'queue_name',
98 'type' => CRM_Utils_Type::T_STRING,
c3fc2621 99 'title' => ts('Queue Name'),
215b423e 100 'description' => ts('Name of the queue which includes this item'),
c3fc2621 101 'required' => TRUE,
e501603b
TO
102 'maxlength' => 64,
103 'size' => CRM_Utils_Type::BIG,
a36434b9 104 'where' => 'civicrm_queue_item.queue_name',
522a26c9 105 'table_name' => 'civicrm_queue_item',
106 'entity' => 'QueueItem',
107 'bao' => 'CRM_Queue_BAO_QueueItem',
6a7e5e5d 108 'localizable' => 0,
c3fc2621 109 'html' => [
e501603b 110 'type' => 'Text',
c3fc2621
CW
111 ],
112 ],
113 'weight' => [
e501603b
TO
114 'name' => 'weight',
115 'type' => CRM_Utils_Type::T_INT,
c3fc2621
CW
116 'title' => ts('Order'),
117 'required' => TRUE,
a36434b9 118 'where' => 'civicrm_queue_item.weight',
522a26c9 119 'table_name' => 'civicrm_queue_item',
120 'entity' => 'QueueItem',
121 'bao' => 'CRM_Queue_BAO_QueueItem',
6a7e5e5d 122 'localizable' => 0,
c3fc2621 123 'html' => [
e501603b 124 'type' => 'Text',
c3fc2621
CW
125 ],
126 ],
127 'submit_time' => [
e501603b
TO
128 'name' => 'submit_time',
129 'type' => CRM_Utils_Type::T_DATE + CRM_Utils_Type::T_TIME,
c3fc2621 130 'title' => ts('Submit Time'),
215b423e 131 'description' => ts('date on which this item was submitted to the queue'),
c3fc2621 132 'required' => TRUE,
a36434b9 133 'where' => 'civicrm_queue_item.submit_time',
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' => 'Select Date',
c3fc2621
CW
140 ],
141 ],
142 'release_time' => [
e501603b
TO
143 'name' => 'release_time',
144 'type' => CRM_Utils_Type::T_DATE + CRM_Utils_Type::T_TIME,
c3fc2621 145 'title' => ts('Release Time'),
215b423e 146 'description' => ts('date on which this job becomes available; null if ASAP'),
a36434b9 147 'where' => 'civicrm_queue_item.release_time',
522a26c9 148 'table_name' => 'civicrm_queue_item',
149 'entity' => 'QueueItem',
150 'bao' => 'CRM_Queue_BAO_QueueItem',
6a7e5e5d 151 'localizable' => 0,
c3fc2621 152 'html' => [
e501603b 153 'type' => 'Select Date',
c3fc2621
CW
154 ],
155 ],
156 'data' => [
e501603b
TO
157 'name' => 'data',
158 'type' => CRM_Utils_Type::T_TEXT,
c3fc2621 159 'title' => ts('Queue item data'),
215b423e 160 'description' => ts('Serialized queue data'),
a36434b9 161 'where' => 'civicrm_queue_item.data',
522a26c9 162 'table_name' => 'civicrm_queue_item',
163 'entity' => 'QueueItem',
164 'bao' => 'CRM_Queue_BAO_QueueItem',
6a7e5e5d 165 'localizable' => 0,
2a5c9b4d 166 'serialize' => self::SERIALIZE_PHP,
c3fc2621
CW
167 ],
168 ];
346aaaba 169 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']);
e501603b 170 }
346aaaba 171 return Civi::$statics[__CLASS__]['fields'];
e501603b 172 }
c3fc2621 173
e501603b 174 /**
bd8e0b14 175 * Return a mapping from field-name to the corresponding key (as used in fields()).
e501603b
TO
176 *
177 * @return array
bd8e0b14 178 * Array(string $name => string $uniqueName).
e501603b 179 */
c3fc2621 180 public static function &fieldKeys() {
bd8e0b14
TO
181 if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) {
182 Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields()));
e501603b 183 }
bd8e0b14 184 return Civi::$statics[__CLASS__]['fieldKeys'];
e501603b 185 }
c3fc2621 186
e501603b
TO
187 /**
188 * Returns the names of this table
189 *
190 * @return string
191 */
c3fc2621 192 public static function getTableName() {
e501603b
TO
193 return self::$_tableName;
194 }
c3fc2621 195
e501603b
TO
196 /**
197 * Returns if this table needs to be logged
198 *
c3fc2621 199 * @return bool
e501603b 200 */
c3fc2621 201 public function getLog() {
e501603b
TO
202 return self::$_log;
203 }
c3fc2621 204
e501603b
TO
205 /**
206 * Returns the list of fields that can be imported
207 *
208 * @param bool $prefix
209 *
210 * @return array
211 */
c3fc2621
CW
212 public static function &import($prefix = FALSE) {
213 $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'queue_item', $prefix, []);
60808919 214 return $r;
e501603b 215 }
c3fc2621 216
e501603b
TO
217 /**
218 * Returns the list of fields that can be exported
219 *
220 * @param bool $prefix
221 *
222 * @return array
223 */
c3fc2621
CW
224 public static function &export($prefix = FALSE) {
225 $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'queue_item', $prefix, []);
60808919 226 return $r;
e501603b 227 }
c3fc2621 228
e7a6b91a
AS
229 /**
230 * Returns the list of indices
c3fc2621
CW
231 *
232 * @param bool $localize
233 *
234 * @return array
e7a6b91a
AS
235 */
236 public static function indices($localize = TRUE) {
c3fc2621
CW
237 $indices = [
238 'index_queueids' => [
e7a6b91a 239 'name' => 'index_queueids',
c3fc2621 240 'field' => [
e7a6b91a
AS
241 0 => 'queue_name',
242 1 => 'weight',
243 2 => 'id',
c3fc2621
CW
244 ],
245 'localizable' => FALSE,
e7a6b91a 246 'sig' => 'civicrm_queue_item::0::queue_name::weight::id',
c3fc2621
CW
247 ],
248 ];
e7a6b91a
AS
249 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices;
250 }
c3fc2621 251
e501603b 252}