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:9aea04911ddc80492007b3217709ba9f)
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 * Icon associated with this entity.
29 public static $_icon = 'fa-tag';
32 * Should CiviCRM log any modifications to this table in the civicrm_log table.
36 public static $_log = TRUE;
53 * Optional verbose description of the tag.
60 * Optional parent id for this tag.
67 * Is this tag selectable / displayed
71 public $is_selectable;
89 * FK to civicrm_contact, who created this tag
96 * Hex color value e.g. #ffffff
103 * Date and time that tag was created.
107 public $created_date;
112 public function __construct() {
113 $this->__table
= 'civicrm_tag';
114 parent
::__construct();
118 * Returns localized title of this entity.
120 public static function getEntityTitle() {
125 * Returns foreign keys and entity references.
128 * [CRM_Core_Reference_Interface]
130 public static function getReferenceColumns() {
131 if (!isset(Civi
::$statics[__CLASS__
]['links'])) {
132 Civi
::$statics[__CLASS__
]['links'] = static::createReferenceColumns(__CLASS__
);
133 Civi
::$statics[__CLASS__
]['links'][] = new CRM_Core_Reference_Basic(self
::getTableName(), 'parent_id', 'civicrm_tag', 'id');
134 Civi
::$statics[__CLASS__
]['links'][] = new CRM_Core_Reference_Basic(self
::getTableName(), 'created_id', 'civicrm_contact', 'id');
135 CRM_Core_DAO_AllCoreTables
::invoke(__CLASS__
, 'links_callback', Civi
::$statics[__CLASS__
]['links']);
137 return Civi
::$statics[__CLASS__
]['links'];
141 * Returns all the column names of this table
145 public static function &fields() {
146 if (!isset(Civi
::$statics[__CLASS__
]['fields'])) {
147 Civi
::$statics[__CLASS__
]['fields'] = [
150 'type' => CRM_Utils_Type
::T_INT
,
151 'title' => ts('Tag ID'),
152 'description' => ts('Tag ID'),
154 'where' => 'civicrm_tag.id',
155 'table_name' => 'civicrm_tag',
157 'bao' => 'CRM_Core_BAO_Tag',
162 'type' => CRM_Utils_Type
::T_STRING
,
163 'title' => ts('Tag Name'),
164 'description' => ts('Name of Tag.'),
167 'size' => CRM_Utils_Type
::BIG
,
168 'where' => 'civicrm_tag.name',
169 'table_name' => 'civicrm_tag',
171 'bao' => 'CRM_Core_BAO_Tag',
175 'name' => 'description',
176 'type' => CRM_Utils_Type
::T_STRING
,
177 'title' => ts('Description'),
178 'description' => ts('Optional verbose description of the tag.'),
180 'size' => CRM_Utils_Type
::HUGE
,
181 'where' => 'civicrm_tag.description',
182 'table_name' => 'civicrm_tag',
184 'bao' => 'CRM_Core_BAO_Tag',
188 'name' => 'parent_id',
189 'type' => CRM_Utils_Type
::T_INT
,
190 'title' => ts('Parent Tag'),
191 'description' => ts('Optional parent id for this tag.'),
192 'where' => 'civicrm_tag.parent_id',
194 'table_name' => 'civicrm_tag',
196 'bao' => 'CRM_Core_BAO_Tag',
198 'FKClassName' => 'CRM_Core_DAO_Tag',
199 'pseudoconstant' => [
200 'table' => 'civicrm_tag',
202 'labelColumn' => 'name',
206 'name' => 'is_selectable',
207 'type' => CRM_Utils_Type
::T_BOOLEAN
,
208 'title' => ts('Display Tag?'),
209 'description' => ts('Is this tag selectable / displayed'),
210 'where' => 'civicrm_tag.is_selectable',
212 'table_name' => 'civicrm_tag',
214 'bao' => 'CRM_Core_BAO_Tag',
218 'name' => 'is_reserved',
219 'type' => CRM_Utils_Type
::T_BOOLEAN
,
220 'title' => ts('Reserved'),
221 'where' => 'civicrm_tag.is_reserved',
223 'table_name' => 'civicrm_tag',
225 'bao' => 'CRM_Core_BAO_Tag',
229 'name' => 'is_tagset',
230 'type' => CRM_Utils_Type
::T_BOOLEAN
,
231 'title' => ts('Tagset'),
232 'where' => 'civicrm_tag.is_tagset',
234 'table_name' => 'civicrm_tag',
236 'bao' => 'CRM_Core_BAO_Tag',
240 'name' => 'used_for',
241 'type' => CRM_Utils_Type
::T_STRING
,
242 'title' => ts('Used For'),
244 'size' => CRM_Utils_Type
::BIG
,
245 'where' => 'civicrm_tag.used_for',
247 'table_name' => 'civicrm_tag',
249 'bao' => 'CRM_Core_BAO_Tag',
251 'serialize' => self
::SERIALIZE_COMMA
,
255 'pseudoconstant' => [
256 'optionGroupName' => 'tag_used_for',
257 'optionEditPath' => 'civicrm/admin/options/tag_used_for',
261 'name' => 'created_id',
262 'type' => CRM_Utils_Type
::T_INT
,
263 'title' => ts('Tag Created By'),
264 'description' => ts('FK to civicrm_contact, who created this tag'),
265 'where' => 'civicrm_tag.created_id',
266 'table_name' => 'civicrm_tag',
268 'bao' => 'CRM_Core_BAO_Tag',
270 'FKClassName' => 'CRM_Contact_DAO_Contact',
274 'type' => CRM_Utils_Type
::T_STRING
,
275 'title' => ts('Color'),
276 'description' => ts('Hex color value e.g. #ffffff'),
278 'size' => CRM_Utils_Type
::HUGE
,
279 'where' => 'civicrm_tag.color',
281 'table_name' => 'civicrm_tag',
283 'bao' => 'CRM_Core_BAO_Tag',
287 'name' => 'created_date',
288 'type' => CRM_Utils_Type
::T_DATE + CRM_Utils_Type
::T_TIME
,
289 'title' => ts('Tag Created Date'),
290 'description' => ts('Date and time that tag was created.'),
291 'where' => 'civicrm_tag.created_date',
292 'table_name' => 'civicrm_tag',
294 'bao' => 'CRM_Core_BAO_Tag',
298 CRM_Core_DAO_AllCoreTables
::invoke(__CLASS__
, 'fields_callback', Civi
::$statics[__CLASS__
]['fields']);
300 return Civi
::$statics[__CLASS__
]['fields'];
304 * Return a mapping from field-name to the corresponding key (as used in fields()).
307 * Array(string $name => string $uniqueName).
309 public static function &fieldKeys() {
310 if (!isset(Civi
::$statics[__CLASS__
]['fieldKeys'])) {
311 Civi
::$statics[__CLASS__
]['fieldKeys'] = array_flip(CRM_Utils_Array
::collect('name', self
::fields()));
313 return Civi
::$statics[__CLASS__
]['fieldKeys'];
317 * Returns the names of this table
321 public static function getTableName() {
322 return self
::$_tableName;
326 * Returns if this table needs to be logged
330 public function getLog() {
335 * Returns the list of fields that can be imported
337 * @param bool $prefix
341 public static function &import($prefix = FALSE) {
342 $r = CRM_Core_DAO_AllCoreTables
::getImports(__CLASS__
, 'tag', $prefix, []);
347 * Returns the list of fields that can be exported
349 * @param bool $prefix
353 public static function &export($prefix = FALSE) {
354 $r = CRM_Core_DAO_AllCoreTables
::getExports(__CLASS__
, 'tag', $prefix, []);
359 * Returns the list of indices
361 * @param bool $localize
365 public static function indices($localize = TRUE) {
372 'localizable' => FALSE,
374 'sig' => 'civicrm_tag::1::name',
377 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables
::multilingualize(__CLASS__
, $indices) : $indices;