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