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