Merge pull request #22552 from colemanw/searchKitConditionalCss
[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:08890bdce3ccfede0d5963b2a0a6fa98)
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
35 */
36 public $id;
37
38 /**
39 * Name of the queue
40 *
41 * @var string
42 */
43 public $name;
44
45 /**
46 * Type of the queue
47 *
48 * @var string
49 */
50 public $type;
51
52 /**
53 * Should the standard background attempt to autorun tasks in this queue?
54 *
55 * @var bool
56 */
57 public $is_autorun;
58
59 /**
60 * Class constructor.
61 */
62 public function __construct() {
63 $this->__table = 'civicrm_queue';
64 parent::__construct();
65 }
66
67 /**
68 * Returns localized title of this entity.
69 *
70 * @param bool $plural
71 * Whether to return the plural version of the title.
72 */
73 public static function getEntityTitle($plural = FALSE) {
74 return $plural ? ts('Queues') : ts('Queue');
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('System Queue ID'),
89 'required' => TRUE,
90 'where' => 'civicrm_queue.id',
91 'table_name' => 'civicrm_queue',
92 'entity' => 'Queue',
93 'bao' => 'CRM_Queue_BAO_Queue',
94 'localizable' => 0,
95 'html' => [
96 'type' => 'Number',
97 ],
98 'readonly' => TRUE,
99 'add' => '5.47',
100 ],
101 'name' => [
102 'name' => 'name',
103 'type' => CRM_Utils_Type::T_STRING,
104 'title' => ts('Name'),
105 'description' => ts('Name of the queue'),
106 'required' => TRUE,
107 'maxlength' => 64,
108 'size' => CRM_Utils_Type::BIG,
109 'where' => 'civicrm_queue.name',
110 'table_name' => 'civicrm_queue',
111 'entity' => 'Queue',
112 'bao' => 'CRM_Queue_BAO_Queue',
113 'localizable' => 0,
114 'html' => [
115 'type' => 'Text',
116 ],
117 'add' => '5.47',
118 ],
119 'type' => [
120 'name' => 'type',
121 'type' => CRM_Utils_Type::T_STRING,
122 'title' => ts('Type'),
123 'description' => ts('Type of the queue'),
124 'required' => TRUE,
125 'maxlength' => 64,
126 'size' => CRM_Utils_Type::BIG,
127 'where' => 'civicrm_queue.type',
128 'table_name' => 'civicrm_queue',
129 'entity' => 'Queue',
130 'bao' => 'CRM_Queue_BAO_Queue',
131 'localizable' => 0,
132 'html' => [
133 'type' => 'Text',
134 ],
135 'pseudoconstant' => [
136 'callback' => 'CRM_Queue_BAO_Queue::getTypes',
137 ],
138 'add' => '5.47',
139 ],
140 'is_autorun' => [
141 'name' => 'is_autorun',
142 'type' => CRM_Utils_Type::T_BOOLEAN,
143 'title' => ts('Enable Autorun'),
144 'description' => ts('Should the standard background attempt to autorun tasks in this queue?'),
145 'where' => 'civicrm_queue.is_autorun',
146 'table_name' => 'civicrm_queue',
147 'entity' => 'Queue',
148 'bao' => 'CRM_Queue_BAO_Queue',
149 'localizable' => 0,
150 'html' => [
151 'type' => 'CheckBox',
152 'label' => ts("Auto Run"),
153 ],
154 'add' => NULL,
155 ],
156 ];
157 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']);
158 }
159 return Civi::$statics[__CLASS__]['fields'];
160 }
161
162 /**
163 * Return a mapping from field-name to the corresponding key (as used in fields()).
164 *
165 * @return array
166 * Array(string $name => string $uniqueName).
167 */
168 public static function &fieldKeys() {
169 if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) {
170 Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields()));
171 }
172 return Civi::$statics[__CLASS__]['fieldKeys'];
173 }
174
175 /**
176 * Returns the names of this table
177 *
178 * @return string
179 */
180 public static function getTableName() {
181 return self::$_tableName;
182 }
183
184 /**
185 * Returns if this table needs to be logged
186 *
187 * @return bool
188 */
189 public function getLog() {
190 return self::$_log;
191 }
192
193 /**
194 * Returns the list of fields that can be imported
195 *
196 * @param bool $prefix
197 *
198 * @return array
199 */
200 public static function &import($prefix = FALSE) {
201 $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'queue', $prefix, []);
202 return $r;
203 }
204
205 /**
206 * Returns the list of fields that can be exported
207 *
208 * @param bool $prefix
209 *
210 * @return array
211 */
212 public static function &export($prefix = FALSE) {
213 $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'queue', $prefix, []);
214 return $r;
215 }
216
217 /**
218 * Returns the list of indices
219 *
220 * @param bool $localize
221 *
222 * @return array
223 */
224 public static function indices($localize = TRUE) {
225 $indices = [
226 'UI_name' => [
227 'name' => 'UI_name',
228 'field' => [
229 0 => 'name',
230 ],
231 'localizable' => FALSE,
232 'unique' => TRUE,
233 'sig' => 'civicrm_queue::1::name',
234 ],
235 ];
236 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices;
237 }
238
239 }