Regenerate DAOs with readonly attribute for id fields
[civicrm-core.git] / CRM / Queue / DAO / QueueItem.php
CommitLineData
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
1fe423d6 9 * (GenCodeChecksum:e720570f92fa1a377b108e5fdacf046f)
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 {
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,
2cbbebe8
A
107 'html' => [
108 'type' => 'Number',
109 ],
1fe423d6 110 'readonly' => TRUE,
a9d0587b 111 'add' => NULL,
c3fc2621
CW
112 ],
113 'queue_name' => [
e501603b
TO
114 'name' => 'queue_name',
115 'type' => CRM_Utils_Type::T_STRING,
c3fc2621 116 'title' => ts('Queue Name'),
215b423e 117 'description' => ts('Name of the queue which includes this item'),
c3fc2621 118 'required' => TRUE,
e501603b
TO
119 'maxlength' => 64,
120 'size' => CRM_Utils_Type::BIG,
a36434b9 121 'where' => 'civicrm_queue_item.queue_name',
522a26c9 122 'table_name' => 'civicrm_queue_item',
123 'entity' => 'QueueItem',
124 'bao' => 'CRM_Queue_BAO_QueueItem',
6a7e5e5d 125 'localizable' => 0,
c3fc2621 126 'html' => [
e501603b 127 'type' => 'Text',
c3fc2621 128 ],
a9d0587b 129 'add' => NULL,
c3fc2621
CW
130 ],
131 'weight' => [
e501603b
TO
132 'name' => 'weight',
133 'type' => CRM_Utils_Type::T_INT,
c3fc2621
CW
134 'title' => ts('Order'),
135 'required' => TRUE,
a36434b9 136 'where' => 'civicrm_queue_item.weight',
522a26c9 137 'table_name' => 'civicrm_queue_item',
138 'entity' => 'QueueItem',
139 'bao' => 'CRM_Queue_BAO_QueueItem',
6a7e5e5d 140 'localizable' => 0,
c3fc2621 141 'html' => [
e501603b 142 'type' => 'Text',
c3fc2621 143 ],
a9d0587b 144 'add' => NULL,
c3fc2621
CW
145 ],
146 'submit_time' => [
e501603b
TO
147 'name' => 'submit_time',
148 'type' => CRM_Utils_Type::T_DATE + CRM_Utils_Type::T_TIME,
c3fc2621 149 'title' => ts('Submit Time'),
215b423e 150 'description' => ts('date on which this item was submitted to the queue'),
c3fc2621 151 'required' => TRUE,
a36434b9 152 'where' => 'civicrm_queue_item.submit_time',
522a26c9 153 'table_name' => 'civicrm_queue_item',
154 'entity' => 'QueueItem',
155 'bao' => 'CRM_Queue_BAO_QueueItem',
6a7e5e5d 156 'localizable' => 0,
c3fc2621 157 'html' => [
e501603b 158 'type' => 'Select Date',
efcda6b9 159 'formatType' => 'activityDateTime',
c3fc2621 160 ],
a9d0587b 161 'add' => NULL,
c3fc2621
CW
162 ],
163 'release_time' => [
e501603b
TO
164 'name' => 'release_time',
165 'type' => CRM_Utils_Type::T_DATE + CRM_Utils_Type::T_TIME,
c3fc2621 166 'title' => ts('Release Time'),
215b423e 167 'description' => ts('date on which this job becomes available; null if ASAP'),
a36434b9 168 'where' => 'civicrm_queue_item.release_time',
522a26c9 169 'table_name' => 'civicrm_queue_item',
170 'entity' => 'QueueItem',
171 'bao' => 'CRM_Queue_BAO_QueueItem',
6a7e5e5d 172 'localizable' => 0,
c3fc2621 173 'html' => [
e501603b 174 'type' => 'Select Date',
efcda6b9 175 'formatType' => 'activityDateTime',
c3fc2621 176 ],
a9d0587b 177 'add' => NULL,
c3fc2621
CW
178 ],
179 'data' => [
e501603b
TO
180 'name' => 'data',
181 'type' => CRM_Utils_Type::T_TEXT,
c3fc2621 182 'title' => ts('Queue item data'),
215b423e 183 'description' => ts('Serialized queue data'),
a36434b9 184 'where' => 'civicrm_queue_item.data',
522a26c9 185 'table_name' => 'civicrm_queue_item',
186 'entity' => 'QueueItem',
187 'bao' => 'CRM_Queue_BAO_QueueItem',
6a7e5e5d 188 'localizable' => 0,
2a5c9b4d 189 'serialize' => self::SERIALIZE_PHP,
a9d0587b 190 'add' => NULL,
c3fc2621
CW
191 ],
192 ];
346aaaba 193 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']);
e501603b 194 }
346aaaba 195 return Civi::$statics[__CLASS__]['fields'];
e501603b 196 }
c3fc2621 197
e501603b 198 /**
bd8e0b14 199 * Return a mapping from field-name to the corresponding key (as used in fields()).
e501603b
TO
200 *
201 * @return array
bd8e0b14 202 * Array(string $name => string $uniqueName).
e501603b 203 */
c3fc2621 204 public static function &fieldKeys() {
bd8e0b14
TO
205 if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) {
206 Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields()));
e501603b 207 }
bd8e0b14 208 return Civi::$statics[__CLASS__]['fieldKeys'];
e501603b 209 }
c3fc2621 210
e501603b
TO
211 /**
212 * Returns the names of this table
213 *
214 * @return string
215 */
c3fc2621 216 public static function getTableName() {
e501603b
TO
217 return self::$_tableName;
218 }
c3fc2621 219
e501603b
TO
220 /**
221 * Returns if this table needs to be logged
222 *
c3fc2621 223 * @return bool
e501603b 224 */
c3fc2621 225 public function getLog() {
e501603b
TO
226 return self::$_log;
227 }
c3fc2621 228
e501603b
TO
229 /**
230 * Returns the list of fields that can be imported
231 *
232 * @param bool $prefix
233 *
234 * @return array
235 */
c3fc2621
CW
236 public static function &import($prefix = FALSE) {
237 $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'queue_item', $prefix, []);
60808919 238 return $r;
e501603b 239 }
c3fc2621 240
e501603b
TO
241 /**
242 * Returns the list of fields that can be exported
243 *
244 * @param bool $prefix
245 *
246 * @return array
247 */
c3fc2621
CW
248 public static function &export($prefix = FALSE) {
249 $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'queue_item', $prefix, []);
60808919 250 return $r;
e501603b 251 }
c3fc2621 252
e7a6b91a
AS
253 /**
254 * Returns the list of indices
c3fc2621
CW
255 *
256 * @param bool $localize
257 *
258 * @return array
e7a6b91a
AS
259 */
260 public static function indices($localize = TRUE) {
c3fc2621
CW
261 $indices = [
262 'index_queueids' => [
e7a6b91a 263 'name' => 'index_queueids',
c3fc2621 264 'field' => [
e7a6b91a
AS
265 0 => 'queue_name',
266 1 => 'weight',
267 2 => 'id',
c3fc2621
CW
268 ],
269 'localizable' => FALSE,
e7a6b91a 270 'sig' => 'civicrm_queue_item::0::queue_name::weight::id',
c3fc2621
CW
271 ],
272 ];
e7a6b91a
AS
273 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices;
274 }
c3fc2621 275
e501603b 276}