Merge pull request #18148 from civicrm/5.29
[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:484a16ebc1b881e7718bfcf139024ee7)
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 public static function getEntityTitle() {
120 return ts('Print Labels');
121 }
122
123 /**
124 * Returns foreign keys and entity references.
125 *
126 * @return array
127 * [CRM_Core_Reference_Interface]
128 */
129 public static function getReferenceColumns() {
130 if (!isset(Civi::$statics[__CLASS__]['links'])) {
131 Civi::$statics[__CLASS__]['links'] = static::createReferenceColumns(__CLASS__);
132 Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'created_id', 'civicrm_contact', 'id');
133 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'links_callback', Civi::$statics[__CLASS__]['links']);
134 }
135 return Civi::$statics[__CLASS__]['links'];
136 }
137
138 /**
139 * Returns all the column names of this table
140 *
141 * @return array
142 */
143 public static function &fields() {
144 if (!isset(Civi::$statics[__CLASS__]['fields'])) {
145 Civi::$statics[__CLASS__]['fields'] = [
146 'id' => [
147 'name' => 'id',
148 'type' => CRM_Utils_Type::T_INT,
149 'title' => ts('Print Label ID'),
150 'required' => TRUE,
151 'where' => 'civicrm_print_label.id',
152 'table_name' => 'civicrm_print_label',
153 'entity' => 'PrintLabel',
154 'bao' => 'CRM_Core_DAO_PrintLabel',
155 'localizable' => 0,
156 'add' => '4.4',
157 ],
158 'title' => [
159 'name' => 'title',
160 'type' => CRM_Utils_Type::T_STRING,
161 'title' => ts('Title'),
162 'description' => ts('User title for this label layout'),
163 'maxlength' => 255,
164 'size' => CRM_Utils_Type::HUGE,
165 'where' => 'civicrm_print_label.title',
166 'table_name' => 'civicrm_print_label',
167 'entity' => 'PrintLabel',
168 'bao' => 'CRM_Core_DAO_PrintLabel',
169 'localizable' => 0,
170 'add' => '4.4',
171 ],
172 'name' => [
173 'name' => 'name',
174 'type' => CRM_Utils_Type::T_STRING,
175 'title' => ts('Name'),
176 'description' => ts('variable name/programmatic handle for this field.'),
177 'maxlength' => 255,
178 'size' => CRM_Utils_Type::HUGE,
179 'where' => 'civicrm_print_label.name',
180 'table_name' => 'civicrm_print_label',
181 'entity' => 'PrintLabel',
182 'bao' => 'CRM_Core_DAO_PrintLabel',
183 'localizable' => 0,
184 'add' => '4.4',
185 ],
186 'description' => [
187 'name' => 'description',
188 'type' => CRM_Utils_Type::T_TEXT,
189 'title' => ts('Description'),
190 'description' => ts('Description of this label layout'),
191 'where' => 'civicrm_print_label.description',
192 'table_name' => 'civicrm_print_label',
193 'entity' => 'PrintLabel',
194 'bao' => 'CRM_Core_DAO_PrintLabel',
195 'localizable' => 0,
196 'add' => '4.4',
197 ],
198 'label_format_name' => [
199 'name' => 'label_format_name',
200 'type' => CRM_Utils_Type::T_STRING,
201 'title' => ts('Label Format'),
202 'description' => ts('This refers to name column of civicrm_option_value row in name_badge option group'),
203 'maxlength' => 255,
204 'size' => CRM_Utils_Type::HUGE,
205 'where' => 'civicrm_print_label.label_format_name',
206 'table_name' => 'civicrm_print_label',
207 'entity' => 'PrintLabel',
208 'bao' => 'CRM_Core_DAO_PrintLabel',
209 'localizable' => 0,
210 'html' => [
211 'type' => 'Select',
212 ],
213 'pseudoconstant' => [
214 'optionGroupName' => 'name_badge',
215 'optionEditPath' => 'civicrm/admin/options/name_badge',
216 ],
217 'add' => '4.4',
218 ],
219 'label_type_id' => [
220 'name' => 'label_type_id',
221 'type' => CRM_Utils_Type::T_INT,
222 'title' => ts('Label Type'),
223 'description' => ts('Implicit FK to civicrm_option_value row in NEW label_type option group'),
224 'where' => 'civicrm_print_label.label_type_id',
225 'table_name' => 'civicrm_print_label',
226 'entity' => 'PrintLabel',
227 'bao' => 'CRM_Core_DAO_PrintLabel',
228 'localizable' => 0,
229 'html' => [
230 'type' => 'Select',
231 ],
232 'pseudoconstant' => [
233 'optionGroupName' => 'label_type',
234 'optionEditPath' => 'civicrm/admin/options/label_type',
235 ],
236 'add' => '4.4',
237 ],
238 'data' => [
239 'name' => 'data',
240 'type' => CRM_Utils_Type::T_LONGTEXT,
241 'title' => ts('Data'),
242 'description' => ts('contains json encode configurations options'),
243 'where' => 'civicrm_print_label.data',
244 'table_name' => 'civicrm_print_label',
245 'entity' => 'PrintLabel',
246 'bao' => 'CRM_Core_DAO_PrintLabel',
247 'localizable' => 0,
248 'serialize' => self::SERIALIZE_JSON,
249 'add' => '4.4',
250 ],
251 'is_default' => [
252 'name' => 'is_default',
253 'type' => CRM_Utils_Type::T_BOOLEAN,
254 'title' => ts('Label is Default?'),
255 'description' => ts('Is this default?'),
256 'where' => 'civicrm_print_label.is_default',
257 'default' => '1',
258 'table_name' => 'civicrm_print_label',
259 'entity' => 'PrintLabel',
260 'bao' => 'CRM_Core_DAO_PrintLabel',
261 'localizable' => 0,
262 'add' => '4.4',
263 ],
264 'is_active' => [
265 'name' => 'is_active',
266 'type' => CRM_Utils_Type::T_BOOLEAN,
267 'title' => ts('Label Is Active?'),
268 'description' => ts('Is this option active?'),
269 'where' => 'civicrm_print_label.is_active',
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_reserved' => [
278 'name' => 'is_reserved',
279 'type' => CRM_Utils_Type::T_BOOLEAN,
280 'title' => ts('Is Label Reserved?'),
281 'description' => ts('Is this reserved label?'),
282 'where' => 'civicrm_print_label.is_reserved',
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 'created_id' => [
291 'name' => 'created_id',
292 'type' => CRM_Utils_Type::T_INT,
293 'title' => ts('Label Created By'),
294 'description' => ts('FK to civicrm_contact, who created this label layout'),
295 'where' => 'civicrm_print_label.created_id',
296 'table_name' => 'civicrm_print_label',
297 'entity' => 'PrintLabel',
298 'bao' => 'CRM_Core_DAO_PrintLabel',
299 'localizable' => 0,
300 'FKClassName' => 'CRM_Contact_DAO_Contact',
301 'add' => '4.4',
302 ],
303 ];
304 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']);
305 }
306 return Civi::$statics[__CLASS__]['fields'];
307 }
308
309 /**
310 * Return a mapping from field-name to the corresponding key (as used in fields()).
311 *
312 * @return array
313 * Array(string $name => string $uniqueName).
314 */
315 public static function &fieldKeys() {
316 if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) {
317 Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields()));
318 }
319 return Civi::$statics[__CLASS__]['fieldKeys'];
320 }
321
322 /**
323 * Returns the names of this table
324 *
325 * @return string
326 */
327 public static function getTableName() {
328 return self::$_tableName;
329 }
330
331 /**
332 * Returns if this table needs to be logged
333 *
334 * @return bool
335 */
336 public function getLog() {
337 return self::$_log;
338 }
339
340 /**
341 * Returns the list of fields that can be imported
342 *
343 * @param bool $prefix
344 *
345 * @return array
346 */
347 public static function &import($prefix = FALSE) {
348 $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'print_label', $prefix, []);
349 return $r;
350 }
351
352 /**
353 * Returns the list of fields that can be exported
354 *
355 * @param bool $prefix
356 *
357 * @return array
358 */
359 public static function &export($prefix = FALSE) {
360 $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'print_label', $prefix, []);
361 return $r;
362 }
363
364 /**
365 * Returns the list of indices
366 *
367 * @param bool $localize
368 *
369 * @return array
370 */
371 public static function indices($localize = TRUE) {
372 $indices = [];
373 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices;
374 }
375
376 }