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