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