5 * @copyright CiviCRM LLC https://civicrm.org/licensing
7 * Generated from xml/schema/CRM/Core/Tag.xml
8 * DO NOT EDIT. Generated by CRM_Core_CodeGen
9 * (GenCodeChecksum:18f8021635fed59be1eabc246f6b88cb)
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 public static $_tableName = 'civicrm_tag';
25 * Should CiviCRM log any modifications to this table in the civicrm_log table.
29 public static $_log = TRUE;
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 'where' => 'civicrm_tag.id',
141 'table_name' => 'civicrm_tag',
143 'bao' => 'CRM_Core_BAO_Tag',
148 'type' => CRM_Utils_Type
::T_STRING
,
149 'title' => ts('Tag Name'),
150 'description' => ts('Name of Tag.'),
153 'size' => CRM_Utils_Type
::BIG
,
154 'where' => 'civicrm_tag.name',
155 'table_name' => 'civicrm_tag',
157 'bao' => 'CRM_Core_BAO_Tag',
161 'name' => 'description',
162 'type' => CRM_Utils_Type
::T_STRING
,
163 'title' => ts('Description'),
164 'description' => ts('Optional verbose description of the tag.'),
166 'size' => CRM_Utils_Type
::HUGE
,
167 'where' => 'civicrm_tag.description',
168 'table_name' => 'civicrm_tag',
170 'bao' => 'CRM_Core_BAO_Tag',
174 'name' => 'parent_id',
175 'type' => CRM_Utils_Type
::T_INT
,
176 'title' => ts('Parent Tag'),
177 'description' => ts('Optional parent id for this tag.'),
178 'where' => 'civicrm_tag.parent_id',
180 'table_name' => 'civicrm_tag',
182 'bao' => 'CRM_Core_BAO_Tag',
184 'FKClassName' => 'CRM_Core_DAO_Tag',
185 'pseudoconstant' => [
186 'table' => 'civicrm_tag',
188 'labelColumn' => 'name',
192 'name' => 'is_selectable',
193 'type' => CRM_Utils_Type
::T_BOOLEAN
,
194 'title' => ts('Display Tag?'),
195 'description' => ts('Is this tag selectable / displayed'),
196 'where' => 'civicrm_tag.is_selectable',
198 'table_name' => 'civicrm_tag',
200 'bao' => 'CRM_Core_BAO_Tag',
204 'name' => 'is_reserved',
205 'type' => CRM_Utils_Type
::T_BOOLEAN
,
206 'title' => ts('Reserved'),
207 'where' => 'civicrm_tag.is_reserved',
209 'table_name' => 'civicrm_tag',
211 'bao' => 'CRM_Core_BAO_Tag',
215 'name' => 'is_tagset',
216 'type' => CRM_Utils_Type
::T_BOOLEAN
,
217 'title' => ts('Tagset'),
218 'where' => 'civicrm_tag.is_tagset',
220 'table_name' => 'civicrm_tag',
222 'bao' => 'CRM_Core_BAO_Tag',
226 'name' => 'used_for',
227 'type' => CRM_Utils_Type
::T_STRING
,
228 'title' => ts('Used For'),
230 'size' => CRM_Utils_Type
::BIG
,
231 'where' => 'civicrm_tag.used_for',
233 'table_name' => 'civicrm_tag',
235 'bao' => 'CRM_Core_BAO_Tag',
237 'serialize' => self
::SERIALIZE_COMMA
,
241 'pseudoconstant' => [
242 'optionGroupName' => 'tag_used_for',
243 'optionEditPath' => 'civicrm/admin/options/tag_used_for',
247 'name' => 'created_id',
248 'type' => CRM_Utils_Type
::T_INT
,
249 'title' => ts('Tag Created By'),
250 'description' => ts('FK to civicrm_contact, who created this tag'),
251 'where' => 'civicrm_tag.created_id',
252 'table_name' => 'civicrm_tag',
254 'bao' => 'CRM_Core_BAO_Tag',
256 'FKClassName' => 'CRM_Contact_DAO_Contact',
260 'type' => CRM_Utils_Type
::T_STRING
,
261 'title' => ts('Color'),
262 'description' => ts('Hex color value e.g. #ffffff'),
264 'size' => CRM_Utils_Type
::HUGE
,
265 'where' => 'civicrm_tag.color',
267 'table_name' => 'civicrm_tag',
269 'bao' => 'CRM_Core_BAO_Tag',
273 'name' => 'created_date',
274 'type' => CRM_Utils_Type
::T_DATE + CRM_Utils_Type
::T_TIME
,
275 'title' => ts('Tag Created Date'),
276 'description' => ts('Date and time that tag was created.'),
277 'where' => 'civicrm_tag.created_date',
278 'table_name' => 'civicrm_tag',
280 'bao' => 'CRM_Core_BAO_Tag',
284 CRM_Core_DAO_AllCoreTables
::invoke(__CLASS__
, 'fields_callback', Civi
::$statics[__CLASS__
]['fields']);
286 return Civi
::$statics[__CLASS__
]['fields'];
290 * Return a mapping from field-name to the corresponding key (as used in fields()).
293 * Array(string $name => string $uniqueName).
295 public static function &fieldKeys() {
296 if (!isset(Civi
::$statics[__CLASS__
]['fieldKeys'])) {
297 Civi
::$statics[__CLASS__
]['fieldKeys'] = array_flip(CRM_Utils_Array
::collect('name', self
::fields()));
299 return Civi
::$statics[__CLASS__
]['fieldKeys'];
303 * Returns the names of this table
307 public static function getTableName() {
308 return self
::$_tableName;
312 * Returns if this table needs to be logged
316 public function getLog() {
321 * Returns the list of fields that can be imported
323 * @param bool $prefix
327 public static function &import($prefix = FALSE) {
328 $r = CRM_Core_DAO_AllCoreTables
::getImports(__CLASS__
, 'tag', $prefix, []);
333 * Returns the list of fields that can be exported
335 * @param bool $prefix
339 public static function &export($prefix = FALSE) {
340 $r = CRM_Core_DAO_AllCoreTables
::getExports(__CLASS__
, 'tag', $prefix, []);
345 * Returns the list of indices
347 * @param bool $localize
351 public static function indices($localize = TRUE) {
358 'localizable' => FALSE,
360 'sig' => 'civicrm_tag::1::name',
363 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables
::multilingualize(__CLASS__
, $indices) : $indices;