Merge pull request #22804 from braders/core-2198-dedupe-rules-ui
[civicrm-core.git] / CRM / Queue / DAO / Queue.php
1 <?php
2
3 /**
4 * @package CRM
5 * @copyright CiviCRM LLC https://civicrm.org/licensing
6 *
7 * Generated from xml/schema/CRM/Queue/Queue.xml
8 * DO NOT EDIT. Generated by CRM_Core_CodeGen
9 * (GenCodeChecksum:3b50eca7549430727237a4b2e295df1f)
10 */
11
12 /**
13 * Database access object for the Queue entity.
14 */
15 class CRM_Queue_DAO_Queue extends CRM_Core_DAO {
16 const EXT = 'civicrm';
17 const TABLE_ADDED = '5.47';
18
19 /**
20 * Static instance to hold the table name.
21 *
22 * @var string
23 */
24 public static $_tableName = 'civicrm_queue';
25
26 /**
27 * Should CiviCRM log any modifications to this table in the civicrm_log table.
28 *
29 * @var bool
30 */
31 public static $_log = FALSE;
32
33 /**
34 * @var int|string|null
35 * (SQL type: int unsigned)
36 * Note that values will be retrieved from the database as a string.
37 */
38 public $id;
39
40 /**
41 * Name of the queue
42 *
43 * @var string
44 * (SQL type: varchar(64))
45 * Note that values will be retrieved from the database as a string.
46 */
47 public $name;
48
49 /**
50 * Type of the queue
51 *
52 * @var string
53 * (SQL type: varchar(64))
54 * Note that values will be retrieved from the database as a string.
55 */
56 public $type;
57
58 /**
59 * Name of the task runner
60 *
61 * @var string
62 * (SQL type: varchar(64))
63 * Note that values will be retrieved from the database as a string.
64 */
65 public $runner;
66
67 /**
68 * Maximum number of items in a batch.
69 *
70 * @var int|string
71 * (SQL type: int unsigned)
72 * Note that values will be retrieved from the database as a string.
73 */
74 public $batch_limit;
75
76 /**
77 * When claiming an item (or batch of items) for work, how long should the item(s) be reserved. (Seconds)
78 *
79 * @var int|string
80 * (SQL type: int unsigned)
81 * Note that values will be retrieved from the database as a string.
82 */
83 public $lease_time;
84
85 /**
86 * Number of permitted retries. Set to zero (0) to disable.
87 *
88 * @var int|string
89 * (SQL type: int)
90 * Note that values will be retrieved from the database as a string.
91 */
92 public $retry_limit;
93
94 /**
95 * Number of seconds to wait before retrying a failed execution.
96 *
97 * @var int|string
98 * (SQL type: int)
99 * Note that values will be retrieved from the database as a string.
100 */
101 public $retry_interval;
102
103 /**
104 * Class constructor.
105 */
106 public function __construct() {
107 $this->__table = 'civicrm_queue';
108 parent::__construct();
109 }
110
111 /**
112 * Returns localized title of this entity.
113 *
114 * @param bool $plural
115 * Whether to return the plural version of the title.
116 */
117 public static function getEntityTitle($plural = FALSE) {
118 return $plural ? ts('Queues') : ts('Queue');
119 }
120
121 /**
122 * Returns all the column names of this table
123 *
124 * @return array
125 */
126 public static function &fields() {
127 if (!isset(Civi::$statics[__CLASS__]['fields'])) {
128 Civi::$statics[__CLASS__]['fields'] = [
129 'id' => [
130 'name' => 'id',
131 'type' => CRM_Utils_Type::T_INT,
132 'title' => ts('System Queue ID'),
133 'required' => TRUE,
134 'where' => 'civicrm_queue.id',
135 'table_name' => 'civicrm_queue',
136 'entity' => 'Queue',
137 'bao' => 'CRM_Queue_BAO_Queue',
138 'localizable' => 0,
139 'html' => [
140 'type' => 'Number',
141 ],
142 'readonly' => TRUE,
143 'add' => '5.47',
144 ],
145 'name' => [
146 'name' => 'name',
147 'type' => CRM_Utils_Type::T_STRING,
148 'title' => ts('Name'),
149 'description' => ts('Name of the queue'),
150 'required' => TRUE,
151 'maxlength' => 64,
152 'size' => CRM_Utils_Type::BIG,
153 'where' => 'civicrm_queue.name',
154 'table_name' => 'civicrm_queue',
155 'entity' => 'Queue',
156 'bao' => 'CRM_Queue_BAO_Queue',
157 'localizable' => 0,
158 'html' => [
159 'type' => 'Text',
160 ],
161 'add' => '5.47',
162 ],
163 'type' => [
164 'name' => 'type',
165 'type' => CRM_Utils_Type::T_STRING,
166 'title' => ts('Type'),
167 'description' => ts('Type of the queue'),
168 'required' => TRUE,
169 'maxlength' => 64,
170 'size' => CRM_Utils_Type::BIG,
171 'where' => 'civicrm_queue.type',
172 'table_name' => 'civicrm_queue',
173 'entity' => 'Queue',
174 'bao' => 'CRM_Queue_BAO_Queue',
175 'localizable' => 0,
176 'html' => [
177 'type' => 'Text',
178 ],
179 'pseudoconstant' => [
180 'callback' => 'CRM_Queue_BAO_Queue::getTypes',
181 ],
182 'add' => '5.47',
183 ],
184 'runner' => [
185 'name' => 'runner',
186 'type' => CRM_Utils_Type::T_STRING,
187 'title' => ts('Runner'),
188 'description' => ts('Name of the task runner'),
189 'required' => FALSE,
190 'maxlength' => 64,
191 'size' => CRM_Utils_Type::BIG,
192 'where' => 'civicrm_queue.runner',
193 'table_name' => 'civicrm_queue',
194 'entity' => 'Queue',
195 'bao' => 'CRM_Queue_BAO_Queue',
196 'localizable' => 0,
197 'html' => [
198 'type' => 'Text',
199 ],
200 'add' => '5.48',
201 ],
202 'batch_limit' => [
203 'name' => 'batch_limit',
204 'type' => CRM_Utils_Type::T_INT,
205 'title' => ts('Batch Limit'),
206 'description' => ts('Maximum number of items in a batch.'),
207 'required' => TRUE,
208 'where' => 'civicrm_queue.batch_limit',
209 'default' => '1',
210 'table_name' => 'civicrm_queue',
211 'entity' => 'Queue',
212 'bao' => 'CRM_Queue_BAO_Queue',
213 'localizable' => 0,
214 'html' => [
215 'type' => 'Text',
216 ],
217 'add' => '5.48',
218 ],
219 'lease_time' => [
220 'name' => 'lease_time',
221 'type' => CRM_Utils_Type::T_INT,
222 'title' => ts('Lease Time'),
223 'description' => ts('When claiming an item (or batch of items) for work, how long should the item(s) be reserved. (Seconds)'),
224 'required' => TRUE,
225 'where' => 'civicrm_queue.lease_time',
226 'default' => '3600',
227 'table_name' => 'civicrm_queue',
228 'entity' => 'Queue',
229 'bao' => 'CRM_Queue_BAO_Queue',
230 'localizable' => 0,
231 'html' => [
232 'type' => 'Text',
233 ],
234 'add' => '5.48',
235 ],
236 'retry_limit' => [
237 'name' => 'retry_limit',
238 'type' => CRM_Utils_Type::T_INT,
239 'title' => ts('Retry Limit'),
240 'description' => ts('Number of permitted retries. Set to zero (0) to disable.'),
241 'required' => TRUE,
242 'where' => 'civicrm_queue.retry_limit',
243 'default' => '0',
244 'table_name' => 'civicrm_queue',
245 'entity' => 'Queue',
246 'bao' => 'CRM_Queue_BAO_Queue',
247 'localizable' => 0,
248 'html' => [
249 'type' => 'Text',
250 ],
251 'add' => '5.48',
252 ],
253 'retry_interval' => [
254 'name' => 'retry_interval',
255 'type' => CRM_Utils_Type::T_INT,
256 'title' => ts('Retry Interval'),
257 'description' => ts('Number of seconds to wait before retrying a failed execution.'),
258 'required' => FALSE,
259 'where' => 'civicrm_queue.retry_interval',
260 'table_name' => 'civicrm_queue',
261 'entity' => 'Queue',
262 'bao' => 'CRM_Queue_BAO_Queue',
263 'localizable' => 0,
264 'html' => [
265 'type' => 'Text',
266 ],
267 'add' => '5.48',
268 ],
269 ];
270 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']);
271 }
272 return Civi::$statics[__CLASS__]['fields'];
273 }
274
275 /**
276 * Return a mapping from field-name to the corresponding key (as used in fields()).
277 *
278 * @return array
279 * Array(string $name => string $uniqueName).
280 */
281 public static function &fieldKeys() {
282 if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) {
283 Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields()));
284 }
285 return Civi::$statics[__CLASS__]['fieldKeys'];
286 }
287
288 /**
289 * Returns the names of this table
290 *
291 * @return string
292 */
293 public static function getTableName() {
294 return self::$_tableName;
295 }
296
297 /**
298 * Returns if this table needs to be logged
299 *
300 * @return bool
301 */
302 public function getLog() {
303 return self::$_log;
304 }
305
306 /**
307 * Returns the list of fields that can be imported
308 *
309 * @param bool $prefix
310 *
311 * @return array
312 */
313 public static function &import($prefix = FALSE) {
314 $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'queue', $prefix, []);
315 return $r;
316 }
317
318 /**
319 * Returns the list of fields that can be exported
320 *
321 * @param bool $prefix
322 *
323 * @return array
324 */
325 public static function &export($prefix = FALSE) {
326 $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'queue', $prefix, []);
327 return $r;
328 }
329
330 /**
331 * Returns the list of indices
332 *
333 * @param bool $localize
334 *
335 * @return array
336 */
337 public static function indices($localize = TRUE) {
338 $indices = [
339 'UI_name' => [
340 'name' => 'UI_name',
341 'field' => [
342 0 => 'name',
343 ],
344 'localizable' => FALSE,
345 'unique' => TRUE,
346 'sig' => 'civicrm_queue::1::name',
347 ],
348 ];
349 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices;
350 }
351
352 }