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