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