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