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