5 * @copyright CiviCRM LLC (c) 2004-2019
7 * Generated from xml/schema/CRM/Core/Tag.xml
8 * DO NOT EDIT. Generated by CRM_Core_CodeGen
9 * (GenCodeChecksum:e66cd3973c4f223dd201904b3c59b233)
13 * Database access object for the Tag entity.
15 class CRM_Core_DAO_Tag
extends CRM_Core_DAO
{
18 * Static instance to hold the table name.
22 static $_tableName = 'civicrm_tag';
25 * Should CiviCRM log any modifications to this table in the civicrm_log table.
46 * Optional verbose description of the tag.
53 * Optional parent id for this tag.
60 * Is this tag selectable / displayed
64 public $is_selectable;
82 * FK to civicrm_contact, who created this tag
89 * Hex color value e.g. #ffffff
96 * Date and time that tag was created.
100 public $created_date;
105 public function __construct() {
106 $this->__table
= 'civicrm_tag';
107 parent
::__construct();
111 * Returns foreign keys and entity references.
114 * [CRM_Core_Reference_Interface]
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']);
123 return Civi
::$statics[__CLASS__
]['links'];
127 * Returns all the column names of this table
131 public static function &fields() {
132 if (!isset(Civi
::$statics[__CLASS__
]['fields'])) {
133 Civi
::$statics[__CLASS__
]['fields'] = [
136 'type' => CRM_Utils_Type
::T_INT
,
137 'title' => ts('Tag ID'),
138 'description' => ts('Tag ID'),
140 'table_name' => 'civicrm_tag',
142 'bao' => 'CRM_Core_BAO_Tag',
147 'type' => CRM_Utils_Type
::T_STRING
,
148 'title' => ts('Tag Name'),
149 'description' => ts('Name of Tag.'),
152 'size' => CRM_Utils_Type
::BIG
,
153 'table_name' => 'civicrm_tag',
155 'bao' => 'CRM_Core_BAO_Tag',
159 'name' => 'description',
160 'type' => CRM_Utils_Type
::T_STRING
,
161 'title' => ts('Description'),
162 'description' => ts('Optional verbose description of the tag.'),
164 'size' => CRM_Utils_Type
::HUGE
,
165 'table_name' => 'civicrm_tag',
167 'bao' => 'CRM_Core_BAO_Tag',
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.'),
176 'table_name' => 'civicrm_tag',
178 'bao' => 'CRM_Core_BAO_Tag',
180 'FKClassName' => 'CRM_Core_DAO_Tag',
183 'name' => 'is_selectable',
184 'type' => CRM_Utils_Type
::T_BOOLEAN
,
185 'title' => ts('Display Tag?'),
186 'description' => ts('Is this tag selectable / displayed'),
188 'table_name' => 'civicrm_tag',
190 'bao' => 'CRM_Core_BAO_Tag',
194 'name' => 'is_reserved',
195 'type' => CRM_Utils_Type
::T_BOOLEAN
,
196 'title' => ts('Reserved'),
198 'table_name' => 'civicrm_tag',
200 'bao' => 'CRM_Core_BAO_Tag',
204 'name' => 'is_tagset',
205 'type' => CRM_Utils_Type
::T_BOOLEAN
,
206 'title' => ts('Tagset'),
208 'table_name' => 'civicrm_tag',
210 'bao' => 'CRM_Core_BAO_Tag',
214 'name' => 'used_for',
215 'type' => CRM_Utils_Type
::T_STRING
,
216 'title' => ts('Used For'),
218 'size' => CRM_Utils_Type
::BIG
,
220 'table_name' => 'civicrm_tag',
222 'bao' => 'CRM_Core_BAO_Tag',
227 'pseudoconstant' => [
228 'optionGroupName' => 'tag_used_for',
229 'optionEditPath' => 'civicrm/admin/options/tag_used_for',
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',
239 'bao' => 'CRM_Core_BAO_Tag',
241 'FKClassName' => 'CRM_Contact_DAO_Contact',
245 'type' => CRM_Utils_Type
::T_STRING
,
246 'title' => ts('Color'),
247 'description' => ts('Hex color value e.g. #ffffff'),
249 'size' => CRM_Utils_Type
::HUGE
,
251 'table_name' => 'civicrm_tag',
253 'bao' => 'CRM_Core_BAO_Tag',
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',
263 'bao' => 'CRM_Core_BAO_Tag',
267 CRM_Core_DAO_AllCoreTables
::invoke(__CLASS__
, 'fields_callback', Civi
::$statics[__CLASS__
]['fields']);
269 return Civi
::$statics[__CLASS__
]['fields'];
273 * Return a mapping from field-name to the corresponding key (as used in fields()).
276 * Array(string $name => string $uniqueName).
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()));
282 return Civi
::$statics[__CLASS__
]['fieldKeys'];
286 * Returns the names of this table
290 public static function getTableName() {
291 return self
::$_tableName;
295 * Returns if this table needs to be logged
299 public function getLog() {
304 * Returns the list of fields that can be imported
306 * @param bool $prefix
310 public static function &import($prefix = FALSE) {
311 $r = CRM_Core_DAO_AllCoreTables
::getImports(__CLASS__
, 'tag', $prefix, []);
316 * Returns the list of fields that can be exported
318 * @param bool $prefix
322 public static function &export($prefix = FALSE) {
323 $r = CRM_Core_DAO_AllCoreTables
::getExports(__CLASS__
, 'tag', $prefix, []);
328 * Returns the list of indices
330 * @param bool $localize
334 public static function indices($localize = TRUE) {
341 'localizable' => FALSE,
343 'sig' => 'civicrm_tag::1::name',
346 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables
::multilingualize(__CLASS__
, $indices) : $indices;