DAOs with singular/plural options for entity titles
[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
7b66c3b5 9 * (GenCodeChecksum:9612aababed43ba4eaacc71a727c5ed9)
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,
a9d0587b 159 'add' => '4.4',
c3fc2621
CW
160 ],
161 'title' => [
e501603b
TO
162 'name' => 'title',
163 'type' => CRM_Utils_Type::T_STRING,
c3fc2621 164 'title' => ts('Title'),
01d214aa 165 'description' => ts('User title for this label layout'),
e501603b
TO
166 'maxlength' => 255,
167 'size' => CRM_Utils_Type::HUGE,
a36434b9 168 'where' => 'civicrm_print_label.title',
522a26c9 169 'table_name' => 'civicrm_print_label',
170 'entity' => 'PrintLabel',
171 'bao' => 'CRM_Core_DAO_PrintLabel',
6a7e5e5d 172 'localizable' => 0,
a9d0587b 173 'add' => '4.4',
c3fc2621
CW
174 ],
175 'name' => [
e501603b
TO
176 'name' => 'name',
177 'type' => CRM_Utils_Type::T_STRING,
c3fc2621 178 'title' => ts('Name'),
215b423e 179 'description' => ts('variable name/programmatic handle for this field.'),
e501603b
TO
180 'maxlength' => 255,
181 'size' => CRM_Utils_Type::HUGE,
a36434b9 182 'where' => 'civicrm_print_label.name',
522a26c9 183 'table_name' => 'civicrm_print_label',
184 'entity' => 'PrintLabel',
185 'bao' => 'CRM_Core_DAO_PrintLabel',
6a7e5e5d 186 'localizable' => 0,
a9d0587b 187 'add' => '4.4',
c3fc2621
CW
188 ],
189 'description' => [
e501603b
TO
190 'name' => 'description',
191 'type' => CRM_Utils_Type::T_TEXT,
c3fc2621 192 'title' => ts('Description'),
215b423e 193 'description' => ts('Description of this label layout'),
a36434b9 194 'where' => 'civicrm_print_label.description',
522a26c9 195 'table_name' => 'civicrm_print_label',
196 'entity' => 'PrintLabel',
197 'bao' => 'CRM_Core_DAO_PrintLabel',
6a7e5e5d 198 'localizable' => 0,
a9d0587b 199 'add' => '4.4',
c3fc2621
CW
200 ],
201 'label_format_name' => [
e501603b
TO
202 'name' => 'label_format_name',
203 'type' => CRM_Utils_Type::T_STRING,
c3fc2621 204 'title' => ts('Label Format'),
215b423e 205 'description' => ts('This refers to name column of civicrm_option_value row in name_badge option group'),
e501603b
TO
206 'maxlength' => 255,
207 'size' => CRM_Utils_Type::HUGE,
a36434b9 208 'where' => 'civicrm_print_label.label_format_name',
522a26c9 209 'table_name' => 'civicrm_print_label',
210 'entity' => 'PrintLabel',
211 'bao' => 'CRM_Core_DAO_PrintLabel',
6a7e5e5d 212 'localizable' => 0,
c3fc2621 213 'html' => [
e501603b 214 'type' => 'Select',
c3fc2621
CW
215 ],
216 'pseudoconstant' => [
e501603b
TO
217 'optionGroupName' => 'name_badge',
218 'optionEditPath' => 'civicrm/admin/options/name_badge',
e6ca0a57 219 ],
a9d0587b 220 'add' => '4.4',
c3fc2621
CW
221 ],
222 'label_type_id' => [
e501603b
TO
223 'name' => 'label_type_id',
224 'type' => CRM_Utils_Type::T_INT,
c3fc2621 225 'title' => ts('Label Type'),
215b423e 226 'description' => ts('Implicit FK to civicrm_option_value row in NEW label_type option group'),
a36434b9 227 'where' => 'civicrm_print_label.label_type_id',
522a26c9 228 'table_name' => 'civicrm_print_label',
229 'entity' => 'PrintLabel',
230 'bao' => 'CRM_Core_DAO_PrintLabel',
6a7e5e5d 231 'localizable' => 0,
c3fc2621 232 'html' => [
e501603b 233 'type' => 'Select',
c3fc2621
CW
234 ],
235 'pseudoconstant' => [
e501603b
TO
236 'optionGroupName' => 'label_type',
237 'optionEditPath' => 'civicrm/admin/options/label_type',
e6ca0a57 238 ],
a9d0587b 239 'add' => '4.4',
c3fc2621
CW
240 ],
241 'data' => [
e501603b
TO
242 'name' => 'data',
243 'type' => CRM_Utils_Type::T_LONGTEXT,
c3fc2621 244 'title' => ts('Data'),
215b423e 245 'description' => ts('contains json encode configurations options'),
a36434b9 246 'where' => 'civicrm_print_label.data',
522a26c9 247 'table_name' => 'civicrm_print_label',
248 'entity' => 'PrintLabel',
249 'bao' => 'CRM_Core_DAO_PrintLabel',
6a7e5e5d 250 'localizable' => 0,
2a5c9b4d 251 'serialize' => self::SERIALIZE_JSON,
a9d0587b 252 'add' => '4.4',
c3fc2621
CW
253 ],
254 'is_default' => [
e501603b
TO
255 'name' => 'is_default',
256 'type' => CRM_Utils_Type::T_BOOLEAN,
c3fc2621 257 'title' => ts('Label is Default?'),
215b423e 258 'description' => ts('Is this default?'),
a36434b9 259 'where' => 'civicrm_print_label.is_default',
e501603b 260 'default' => '1',
522a26c9 261 'table_name' => 'civicrm_print_label',
262 'entity' => 'PrintLabel',
263 'bao' => 'CRM_Core_DAO_PrintLabel',
6a7e5e5d 264 'localizable' => 0,
a9d0587b 265 'add' => '4.4',
c3fc2621
CW
266 ],
267 'is_active' => [
e501603b
TO
268 'name' => 'is_active',
269 'type' => CRM_Utils_Type::T_BOOLEAN,
c3fc2621 270 'title' => ts('Label Is Active?'),
215b423e 271 'description' => ts('Is this option active?'),
a36434b9 272 'where' => 'civicrm_print_label.is_active',
e501603b 273 'default' => '1',
522a26c9 274 'table_name' => 'civicrm_print_label',
275 'entity' => 'PrintLabel',
276 'bao' => 'CRM_Core_DAO_PrintLabel',
6a7e5e5d 277 'localizable' => 0,
a9d0587b 278 'add' => '4.4',
c3fc2621
CW
279 ],
280 'is_reserved' => [
e501603b
TO
281 'name' => 'is_reserved',
282 'type' => CRM_Utils_Type::T_BOOLEAN,
c3fc2621 283 'title' => ts('Is Label Reserved?'),
215b423e 284 'description' => ts('Is this reserved label?'),
a36434b9 285 'where' => 'civicrm_print_label.is_reserved',
e501603b 286 'default' => '1',
522a26c9 287 'table_name' => 'civicrm_print_label',
288 'entity' => 'PrintLabel',
289 'bao' => 'CRM_Core_DAO_PrintLabel',
6a7e5e5d 290 'localizable' => 0,
a9d0587b 291 'add' => '4.4',
c3fc2621
CW
292 ],
293 'created_id' => [
e501603b
TO
294 'name' => 'created_id',
295 'type' => CRM_Utils_Type::T_INT,
c3fc2621 296 'title' => ts('Label Created By'),
215b423e 297 'description' => ts('FK to civicrm_contact, who created this label layout'),
a36434b9 298 'where' => 'civicrm_print_label.created_id',
522a26c9 299 'table_name' => 'civicrm_print_label',
300 'entity' => 'PrintLabel',
301 'bao' => 'CRM_Core_DAO_PrintLabel',
6a7e5e5d 302 'localizable' => 0,
e501603b 303 'FKClassName' => 'CRM_Contact_DAO_Contact',
a9d0587b 304 'add' => '4.4',
c3fc2621
CW
305 ],
306 ];
346aaaba 307 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']);
e501603b 308 }
346aaaba 309 return Civi::$statics[__CLASS__]['fields'];
e501603b 310 }
c3fc2621 311
e501603b 312 /**
bd8e0b14 313 * Return a mapping from field-name to the corresponding key (as used in fields()).
e501603b
TO
314 *
315 * @return array
bd8e0b14 316 * Array(string $name => string $uniqueName).
e501603b 317 */
c3fc2621 318 public static function &fieldKeys() {
bd8e0b14
TO
319 if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) {
320 Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields()));
e501603b 321 }
bd8e0b14 322 return Civi::$statics[__CLASS__]['fieldKeys'];
e501603b 323 }
c3fc2621 324
e501603b
TO
325 /**
326 * Returns the names of this table
327 *
328 * @return string
329 */
c3fc2621 330 public static function getTableName() {
e501603b
TO
331 return self::$_tableName;
332 }
c3fc2621 333
e501603b
TO
334 /**
335 * Returns if this table needs to be logged
336 *
c3fc2621 337 * @return bool
e501603b 338 */
c3fc2621 339 public function getLog() {
e501603b
TO
340 return self::$_log;
341 }
c3fc2621 342
e501603b
TO
343 /**
344 * Returns the list of fields that can be imported
345 *
346 * @param bool $prefix
347 *
348 * @return array
349 */
c3fc2621
CW
350 public static function &import($prefix = FALSE) {
351 $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'print_label', $prefix, []);
60808919 352 return $r;
e501603b 353 }
c3fc2621 354
e501603b
TO
355 /**
356 * Returns the list of fields that can be exported
357 *
358 * @param bool $prefix
359 *
360 * @return array
361 */
c3fc2621
CW
362 public static function &export($prefix = FALSE) {
363 $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'print_label', $prefix, []);
60808919 364 return $r;
e501603b 365 }
c3fc2621 366
e7a6b91a
AS
367 /**
368 * Returns the list of indices
c3fc2621
CW
369 *
370 * @param bool $localize
371 *
372 * @return array
e7a6b91a
AS
373 */
374 public static function indices($localize = TRUE) {
c3fc2621 375 $indices = [];
e7a6b91a
AS
376 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices;
377 }
c3fc2621 378
e501603b 379}