Merge pull request #13987 from seamuslee001/new_coder_pcp_pledge_profile_queue_report
[civicrm-core.git] / CRM / Core / DAO / Tag.php
1 <?php
2
3 /**
4 * @package CRM
5 * @copyright CiviCRM LLC (c) 2004-2019
6 *
7 * Generated from xml/schema/CRM/Core/Tag.xml
8 * DO NOT EDIT. Generated by CRM_Core_CodeGen
9 * (GenCodeChecksum:e66cd3973c4f223dd201904b3c59b233)
10 */
11
12 /**
13 * Database access object for the Tag entity.
14 */
15 class CRM_Core_DAO_Tag extends CRM_Core_DAO {
16
17 /**
18 * Static instance to hold the table name.
19 *
20 * @var string
21 */
22 public static $_tableName = 'civicrm_tag';
23
24 /**
25 * Should CiviCRM log any modifications to this table in the civicrm_log table.
26 *
27 * @var bool
28 */
29 public static $_log = TRUE;
30
31 /**
32 * Tag ID
33 *
34 * @var int unsigned
35 */
36 public $id;
37
38 /**
39 * Name of Tag.
40 *
41 * @var string
42 */
43 public $name;
44
45 /**
46 * Optional verbose description of the tag.
47 *
48 * @var string
49 */
50 public $description;
51
52 /**
53 * Optional parent id for this tag.
54 *
55 * @var int unsigned
56 */
57 public $parent_id;
58
59 /**
60 * Is this tag selectable / displayed
61 *
62 * @var boolean
63 */
64 public $is_selectable;
65
66 /**
67 * @var boolean
68 */
69 public $is_reserved;
70
71 /**
72 * @var boolean
73 */
74 public $is_tagset;
75
76 /**
77 * @var string
78 */
79 public $used_for;
80
81 /**
82 * FK to civicrm_contact, who created this tag
83 *
84 * @var int unsigned
85 */
86 public $created_id;
87
88 /**
89 * Hex color value e.g. #ffffff
90 *
91 * @var string
92 */
93 public $color;
94
95 /**
96 * Date and time that tag was created.
97 *
98 * @var datetime
99 */
100 public $created_date;
101
102 /**
103 * Class constructor.
104 */
105 public function __construct() {
106 $this->__table = 'civicrm_tag';
107 parent::__construct();
108 }
109
110 /**
111 * Returns foreign keys and entity references.
112 *
113 * @return array
114 * [CRM_Core_Reference_Interface]
115 */
116 public static function getReferenceColumns() {
117 if (!isset(Civi::$statics[__CLASS__]['links'])) {
118 Civi::$statics[__CLASS__]['links'] = static::createReferenceColumns(__CLASS__);
119 Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'parent_id', 'civicrm_tag', 'id');
120 Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'created_id', 'civicrm_contact', 'id');
121 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'links_callback', Civi::$statics[__CLASS__]['links']);
122 }
123 return Civi::$statics[__CLASS__]['links'];
124 }
125
126 /**
127 * Returns all the column names of this table
128 *
129 * @return array
130 */
131 public static function &fields() {
132 if (!isset(Civi::$statics[__CLASS__]['fields'])) {
133 Civi::$statics[__CLASS__]['fields'] = [
134 'id' => [
135 'name' => 'id',
136 'type' => CRM_Utils_Type::T_INT,
137 'title' => ts('Tag ID'),
138 'description' => ts('Tag ID'),
139 'required' => TRUE,
140 'table_name' => 'civicrm_tag',
141 'entity' => 'Tag',
142 'bao' => 'CRM_Core_BAO_Tag',
143 'localizable' => 0,
144 ],
145 'name' => [
146 'name' => 'name',
147 'type' => CRM_Utils_Type::T_STRING,
148 'title' => ts('Tag Name'),
149 'description' => ts('Name of Tag.'),
150 'required' => TRUE,
151 'maxlength' => 64,
152 'size' => CRM_Utils_Type::BIG,
153 'table_name' => 'civicrm_tag',
154 'entity' => 'Tag',
155 'bao' => 'CRM_Core_BAO_Tag',
156 'localizable' => 0,
157 ],
158 'description' => [
159 'name' => 'description',
160 'type' => CRM_Utils_Type::T_STRING,
161 'title' => ts('Description'),
162 'description' => ts('Optional verbose description of the tag.'),
163 'maxlength' => 255,
164 'size' => CRM_Utils_Type::HUGE,
165 'table_name' => 'civicrm_tag',
166 'entity' => 'Tag',
167 'bao' => 'CRM_Core_BAO_Tag',
168 'localizable' => 0,
169 ],
170 'parent_id' => [
171 'name' => 'parent_id',
172 'type' => CRM_Utils_Type::T_INT,
173 'title' => ts('Parent Tag'),
174 'description' => ts('Optional parent id for this tag.'),
175 'default' => 'NULL',
176 'table_name' => 'civicrm_tag',
177 'entity' => 'Tag',
178 'bao' => 'CRM_Core_BAO_Tag',
179 'localizable' => 0,
180 'FKClassName' => 'CRM_Core_DAO_Tag',
181 ],
182 'is_selectable' => [
183 'name' => 'is_selectable',
184 'type' => CRM_Utils_Type::T_BOOLEAN,
185 'title' => ts('Display Tag?'),
186 'description' => ts('Is this tag selectable / displayed'),
187 'default' => '1',
188 'table_name' => 'civicrm_tag',
189 'entity' => 'Tag',
190 'bao' => 'CRM_Core_BAO_Tag',
191 'localizable' => 0,
192 ],
193 'is_reserved' => [
194 'name' => 'is_reserved',
195 'type' => CRM_Utils_Type::T_BOOLEAN,
196 'title' => ts('Reserved'),
197 'default' => '0',
198 'table_name' => 'civicrm_tag',
199 'entity' => 'Tag',
200 'bao' => 'CRM_Core_BAO_Tag',
201 'localizable' => 0,
202 ],
203 'is_tagset' => [
204 'name' => 'is_tagset',
205 'type' => CRM_Utils_Type::T_BOOLEAN,
206 'title' => ts('Tagset'),
207 'default' => '0',
208 'table_name' => 'civicrm_tag',
209 'entity' => 'Tag',
210 'bao' => 'CRM_Core_BAO_Tag',
211 'localizable' => 0,
212 ],
213 'used_for' => [
214 'name' => 'used_for',
215 'type' => CRM_Utils_Type::T_STRING,
216 'title' => ts('Used For'),
217 'maxlength' => 64,
218 'size' => CRM_Utils_Type::BIG,
219 'default' => 'NULL',
220 'table_name' => 'civicrm_tag',
221 'entity' => 'Tag',
222 'bao' => 'CRM_Core_BAO_Tag',
223 'localizable' => 0,
224 'html' => [
225 'type' => 'Select',
226 ],
227 'pseudoconstant' => [
228 'optionGroupName' => 'tag_used_for',
229 'optionEditPath' => 'civicrm/admin/options/tag_used_for',
230 ]
231 ],
232 'created_id' => [
233 'name' => 'created_id',
234 'type' => CRM_Utils_Type::T_INT,
235 'title' => ts('Tag Created By'),
236 'description' => ts('FK to civicrm_contact, who created this tag'),
237 'table_name' => 'civicrm_tag',
238 'entity' => 'Tag',
239 'bao' => 'CRM_Core_BAO_Tag',
240 'localizable' => 0,
241 'FKClassName' => 'CRM_Contact_DAO_Contact',
242 ],
243 'color' => [
244 'name' => 'color',
245 'type' => CRM_Utils_Type::T_STRING,
246 'title' => ts('Color'),
247 'description' => ts('Hex color value e.g. #ffffff'),
248 'maxlength' => 255,
249 'size' => CRM_Utils_Type::HUGE,
250 'default' => 'NULL',
251 'table_name' => 'civicrm_tag',
252 'entity' => 'Tag',
253 'bao' => 'CRM_Core_BAO_Tag',
254 'localizable' => 0,
255 ],
256 'created_date' => [
257 'name' => 'created_date',
258 'type' => CRM_Utils_Type::T_DATE + CRM_Utils_Type::T_TIME,
259 'title' => ts('Tag Created Date'),
260 'description' => ts('Date and time that tag was created.'),
261 'table_name' => 'civicrm_tag',
262 'entity' => 'Tag',
263 'bao' => 'CRM_Core_BAO_Tag',
264 'localizable' => 0,
265 ],
266 ];
267 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']);
268 }
269 return Civi::$statics[__CLASS__]['fields'];
270 }
271
272 /**
273 * Return a mapping from field-name to the corresponding key (as used in fields()).
274 *
275 * @return array
276 * Array(string $name => string $uniqueName).
277 */
278 public static function &fieldKeys() {
279 if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) {
280 Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields()));
281 }
282 return Civi::$statics[__CLASS__]['fieldKeys'];
283 }
284
285 /**
286 * Returns the names of this table
287 *
288 * @return string
289 */
290 public static function getTableName() {
291 return self::$_tableName;
292 }
293
294 /**
295 * Returns if this table needs to be logged
296 *
297 * @return bool
298 */
299 public function getLog() {
300 return self::$_log;
301 }
302
303 /**
304 * Returns the list of fields that can be imported
305 *
306 * @param bool $prefix
307 *
308 * @return array
309 */
310 public static function &import($prefix = FALSE) {
311 $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'tag', $prefix, []);
312 return $r;
313 }
314
315 /**
316 * Returns the list of fields that can be exported
317 *
318 * @param bool $prefix
319 *
320 * @return array
321 */
322 public static function &export($prefix = FALSE) {
323 $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'tag', $prefix, []);
324 return $r;
325 }
326
327 /**
328 * Returns the list of indices
329 *
330 * @param bool $localize
331 *
332 * @return array
333 */
334 public static function indices($localize = TRUE) {
335 $indices = [
336 'UI_name' => [
337 'name' => 'UI_name',
338 'field' => [
339 0 => 'name',
340 ],
341 'localizable' => FALSE,
342 'unique' => TRUE,
343 'sig' => 'civicrm_tag::1::name',
344 ],
345 ];
346 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices;
347 }
348
349 }