Merge pull request #22428 from civicrm/5.46
[civicrm-core.git] / CRM / Core / DAO / PrintLabel.php
1 <?php
2
3 /**
4 * @package CRM
5 * @copyright CiviCRM LLC https://civicrm.org/licensing
6 *
7 * Generated from xml/schema/CRM/Core/PrintLabel.xml
8 * DO NOT EDIT. Generated by CRM_Core_CodeGen
9 * (GenCodeChecksum:cae6bd3ef03de9c99cd64c3c232fca54)
10 */
11
12 /**
13 * Database access object for the PrintLabel entity.
14 */
15 class CRM_Core_DAO_PrintLabel extends CRM_Core_DAO {
16 const EXT = 'civicrm';
17 const TABLE_ADDED = '4.4';
18
19 /**
20 * Static instance to hold the table name.
21 *
22 * @var string
23 */
24 public static $_tableName = 'civicrm_print_label';
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 * User title for this label layout
40 *
41 * @var string
42 */
43 public $title;
44
45 /**
46 * variable name/programmatic handle for this field.
47 *
48 * @var string
49 */
50 public $name;
51
52 /**
53 * Description of this label layout
54 *
55 * @var text
56 */
57 public $description;
58
59 /**
60 * This refers to name column of civicrm_option_value row in name_badge option group
61 *
62 * @var string
63 */
64 public $label_format_name;
65
66 /**
67 * Implicit FK to civicrm_option_value row in NEW label_type option group
68 *
69 * @var int
70 */
71 public $label_type_id;
72
73 /**
74 * contains json encode configurations options
75 *
76 * @var longtext
77 */
78 public $data;
79
80 /**
81 * Is this default?
82 *
83 * @var bool
84 */
85 public $is_default;
86
87 /**
88 * Is this option active?
89 *
90 * @var bool
91 */
92 public $is_active;
93
94 /**
95 * Is this reserved label?
96 *
97 * @var bool
98 */
99 public $is_reserved;
100
101 /**
102 * FK to civicrm_contact, who created this label layout
103 *
104 * @var int
105 */
106 public $created_id;
107
108 /**
109 * Class constructor.
110 */
111 public function __construct() {
112 $this->__table = 'civicrm_print_label';
113 parent::__construct();
114 }
115
116 /**
117 * Returns localized title of this entity.
118 *
119 * @param bool $plural
120 * Whether to return the plural version of the title.
121 */
122 public static function getEntityTitle($plural = FALSE) {
123 return $plural ? ts('Print Labels') : ts('Print Label');
124 }
125
126 /**
127 * Returns foreign keys and entity references.
128 *
129 * @return array
130 * [CRM_Core_Reference_Interface]
131 */
132 public static function getReferenceColumns() {
133 if (!isset(Civi::$statics[__CLASS__]['links'])) {
134 Civi::$statics[__CLASS__]['links'] = static::createReferenceColumns(__CLASS__);
135 Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'created_id', 'civicrm_contact', 'id');
136 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'links_callback', Civi::$statics[__CLASS__]['links']);
137 }
138 return Civi::$statics[__CLASS__]['links'];
139 }
140
141 /**
142 * Returns all the column names of this table
143 *
144 * @return array
145 */
146 public static function &fields() {
147 if (!isset(Civi::$statics[__CLASS__]['fields'])) {
148 Civi::$statics[__CLASS__]['fields'] = [
149 'id' => [
150 'name' => 'id',
151 'type' => CRM_Utils_Type::T_INT,
152 'title' => ts('Print Label ID'),
153 'required' => TRUE,
154 'where' => 'civicrm_print_label.id',
155 'table_name' => 'civicrm_print_label',
156 'entity' => 'PrintLabel',
157 'bao' => 'CRM_Core_DAO_PrintLabel',
158 'localizable' => 0,
159 'html' => [
160 'type' => 'Number',
161 ],
162 'readonly' => TRUE,
163 'add' => '4.4',
164 ],
165 'title' => [
166 'name' => 'title',
167 'type' => CRM_Utils_Type::T_STRING,
168 'title' => ts('Title'),
169 'description' => ts('User title for this label layout'),
170 'maxlength' => 255,
171 'size' => CRM_Utils_Type::HUGE,
172 'where' => 'civicrm_print_label.title',
173 'table_name' => 'civicrm_print_label',
174 'entity' => 'PrintLabel',
175 'bao' => 'CRM_Core_DAO_PrintLabel',
176 'localizable' => 0,
177 'add' => '4.4',
178 ],
179 'name' => [
180 'name' => 'name',
181 'type' => CRM_Utils_Type::T_STRING,
182 'title' => ts('Name'),
183 'description' => ts('variable name/programmatic handle for this field.'),
184 'maxlength' => 255,
185 'size' => CRM_Utils_Type::HUGE,
186 'where' => 'civicrm_print_label.name',
187 'table_name' => 'civicrm_print_label',
188 'entity' => 'PrintLabel',
189 'bao' => 'CRM_Core_DAO_PrintLabel',
190 'localizable' => 0,
191 'add' => '4.4',
192 ],
193 'description' => [
194 'name' => 'description',
195 'type' => CRM_Utils_Type::T_TEXT,
196 'title' => ts('Description'),
197 'description' => ts('Description of this label layout'),
198 'where' => 'civicrm_print_label.description',
199 'table_name' => 'civicrm_print_label',
200 'entity' => 'PrintLabel',
201 'bao' => 'CRM_Core_DAO_PrintLabel',
202 'localizable' => 0,
203 'html' => [
204 'label' => ts("Description"),
205 ],
206 'add' => '4.4',
207 ],
208 'label_format_name' => [
209 'name' => 'label_format_name',
210 'type' => CRM_Utils_Type::T_STRING,
211 'title' => ts('Label Format'),
212 'description' => ts('This refers to name column of civicrm_option_value row in name_badge option group'),
213 'maxlength' => 255,
214 'size' => CRM_Utils_Type::HUGE,
215 'where' => 'civicrm_print_label.label_format_name',
216 'table_name' => 'civicrm_print_label',
217 'entity' => 'PrintLabel',
218 'bao' => 'CRM_Core_DAO_PrintLabel',
219 'localizable' => 0,
220 'html' => [
221 'type' => 'Select',
222 ],
223 'pseudoconstant' => [
224 'optionGroupName' => 'name_badge',
225 'optionEditPath' => 'civicrm/admin/options/name_badge',
226 ],
227 'add' => '4.4',
228 ],
229 'label_type_id' => [
230 'name' => 'label_type_id',
231 'type' => CRM_Utils_Type::T_INT,
232 'title' => ts('Label Type'),
233 'description' => ts('Implicit FK to civicrm_option_value row in NEW label_type option group'),
234 'where' => 'civicrm_print_label.label_type_id',
235 'table_name' => 'civicrm_print_label',
236 'entity' => 'PrintLabel',
237 'bao' => 'CRM_Core_DAO_PrintLabel',
238 'localizable' => 0,
239 'html' => [
240 'type' => 'Select',
241 ],
242 'pseudoconstant' => [
243 'optionGroupName' => 'label_type',
244 'optionEditPath' => 'civicrm/admin/options/label_type',
245 ],
246 'add' => '4.4',
247 ],
248 'data' => [
249 'name' => 'data',
250 'type' => CRM_Utils_Type::T_LONGTEXT,
251 'title' => ts('Data'),
252 'description' => ts('contains json encode configurations options'),
253 'where' => 'civicrm_print_label.data',
254 'table_name' => 'civicrm_print_label',
255 'entity' => 'PrintLabel',
256 'bao' => 'CRM_Core_DAO_PrintLabel',
257 'localizable' => 0,
258 'serialize' => self::SERIALIZE_JSON,
259 'html' => [
260 'label' => ts("Data"),
261 ],
262 'add' => '4.4',
263 ],
264 'is_default' => [
265 'name' => 'is_default',
266 'type' => CRM_Utils_Type::T_BOOLEAN,
267 'title' => ts('Label is Default?'),
268 'description' => ts('Is this default?'),
269 'where' => 'civicrm_print_label.is_default',
270 'default' => '1',
271 'table_name' => 'civicrm_print_label',
272 'entity' => 'PrintLabel',
273 'bao' => 'CRM_Core_DAO_PrintLabel',
274 'localizable' => 0,
275 'add' => '4.4',
276 ],
277 'is_active' => [
278 'name' => 'is_active',
279 'type' => CRM_Utils_Type::T_BOOLEAN,
280 'title' => ts('Label Is Active?'),
281 'description' => ts('Is this option active?'),
282 'where' => 'civicrm_print_label.is_active',
283 'default' => '1',
284 'table_name' => 'civicrm_print_label',
285 'entity' => 'PrintLabel',
286 'bao' => 'CRM_Core_DAO_PrintLabel',
287 'localizable' => 0,
288 'add' => '4.4',
289 ],
290 'is_reserved' => [
291 'name' => 'is_reserved',
292 'type' => CRM_Utils_Type::T_BOOLEAN,
293 'title' => ts('Is Label Reserved?'),
294 'description' => ts('Is this reserved label?'),
295 'where' => 'civicrm_print_label.is_reserved',
296 'default' => '1',
297 'table_name' => 'civicrm_print_label',
298 'entity' => 'PrintLabel',
299 'bao' => 'CRM_Core_DAO_PrintLabel',
300 'localizable' => 0,
301 'add' => '4.4',
302 ],
303 'created_id' => [
304 'name' => 'created_id',
305 'type' => CRM_Utils_Type::T_INT,
306 'title' => ts('Created By Contact ID'),
307 'description' => ts('FK to civicrm_contact, who created this label layout'),
308 'where' => 'civicrm_print_label.created_id',
309 'table_name' => 'civicrm_print_label',
310 'entity' => 'PrintLabel',
311 'bao' => 'CRM_Core_DAO_PrintLabel',
312 'localizable' => 0,
313 'FKClassName' => 'CRM_Contact_DAO_Contact',
314 'html' => [
315 'label' => ts("Created By"),
316 ],
317 'add' => '4.4',
318 ],
319 ];
320 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']);
321 }
322 return Civi::$statics[__CLASS__]['fields'];
323 }
324
325 /**
326 * Return a mapping from field-name to the corresponding key (as used in fields()).
327 *
328 * @return array
329 * Array(string $name => string $uniqueName).
330 */
331 public static function &fieldKeys() {
332 if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) {
333 Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields()));
334 }
335 return Civi::$statics[__CLASS__]['fieldKeys'];
336 }
337
338 /**
339 * Returns the names of this table
340 *
341 * @return string
342 */
343 public static function getTableName() {
344 return self::$_tableName;
345 }
346
347 /**
348 * Returns if this table needs to be logged
349 *
350 * @return bool
351 */
352 public function getLog() {
353 return self::$_log;
354 }
355
356 /**
357 * Returns the list of fields that can be imported
358 *
359 * @param bool $prefix
360 *
361 * @return array
362 */
363 public static function &import($prefix = FALSE) {
364 $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'print_label', $prefix, []);
365 return $r;
366 }
367
368 /**
369 * Returns the list of fields that can be exported
370 *
371 * @param bool $prefix
372 *
373 * @return array
374 */
375 public static function &export($prefix = FALSE) {
376 $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'print_label', $prefix, []);
377 return $r;
378 }
379
380 /**
381 * Returns the list of indices
382 *
383 * @param bool $localize
384 *
385 * @return array
386 */
387 public static function indices($localize = TRUE) {
388 $indices = [];
389 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices;
390 }
391
392 }