5 * @copyright CiviCRM LLC (c) 2004-2017
7 * Generated from xml/schema/CRM/Core/Tag.xml
8 * DO NOT EDIT. Generated by CRM_Core_CodeGen
9 * (GenCodeChecksum:eb22ef992569566021a7faeaf43f0c25)
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' => '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' => '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' => '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' => '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' => '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'),
197 'table_name' => 'civicrm_tag',
199 'bao' => 'CRM_Core_BAO_Tag',
203 'name' => 'is_tagset',
204 'type' => CRM_Utils_Type
::T_BOOLEAN
,
205 'title' => ts('Tagset'),
206 'table_name' => 'civicrm_tag',
208 'bao' => 'CRM_Core_BAO_Tag',
212 'name' => 'used_for',
213 'type' => CRM_Utils_Type
::T_STRING
,
214 'title' => ts('Used For'),
216 'size' => CRM_Utils_Type
::BIG
,
218 'table_name' => 'civicrm_tag',
220 'bao' => 'CRM_Core_BAO_Tag',
225 'pseudoconstant' => [
226 'optionGroupName' => 'tag_used_for',
227 'optionEditPath' => 'civicrm/admin/options/tag_used_for',
231 'name' => 'created_id',
232 'type' => CRM_Utils_Type
::T_INT
,
233 'title' => ts('Tag Created By'),
234 'description' => 'FK to civicrm_contact, who created this tag',
235 'table_name' => 'civicrm_tag',
237 'bao' => 'CRM_Core_BAO_Tag',
239 'FKClassName' => 'CRM_Contact_DAO_Contact',
243 'type' => CRM_Utils_Type
::T_STRING
,
244 'title' => ts('Color'),
245 'description' => 'Hex color value e.g. #ffffff',
247 'size' => CRM_Utils_Type
::HUGE
,
249 'table_name' => 'civicrm_tag',
251 'bao' => 'CRM_Core_BAO_Tag',
255 'name' => 'created_date',
256 'type' => CRM_Utils_Type
::T_DATE + CRM_Utils_Type
::T_TIME
,
257 'title' => ts('Tag Created Date'),
258 'description' => 'Date and time that tag was created.',
259 'table_name' => 'civicrm_tag',
261 'bao' => 'CRM_Core_BAO_Tag',
265 CRM_Core_DAO_AllCoreTables
::invoke(__CLASS__
, 'fields_callback', Civi
::$statics[__CLASS__
]['fields']);
267 return Civi
::$statics[__CLASS__
]['fields'];
271 * Return a mapping from field-name to the corresponding key (as used in fields()).
274 * Array(string $name => string $uniqueName).
276 public static function &fieldKeys() {
277 if (!isset(Civi
::$statics[__CLASS__
]['fieldKeys'])) {
278 Civi
::$statics[__CLASS__
]['fieldKeys'] = array_flip(CRM_Utils_Array
::collect('name', self
::fields()));
280 return Civi
::$statics[__CLASS__
]['fieldKeys'];
284 * Returns the names of this table
288 public static function getTableName() {
289 return self
::$_tableName;
293 * Returns if this table needs to be logged
297 public function getLog() {
302 * Returns the list of fields that can be imported
304 * @param bool $prefix
308 public static function &import($prefix = FALSE) {
309 $r = CRM_Core_DAO_AllCoreTables
::getImports(__CLASS__
, 'tag', $prefix, []);
314 * Returns the list of fields that can be exported
316 * @param bool $prefix
320 public static function &export($prefix = FALSE) {
321 $r = CRM_Core_DAO_AllCoreTables
::getExports(__CLASS__
, 'tag', $prefix, []);
326 * Returns the list of indices
328 * @param bool $localize
332 public static function indices($localize = TRUE) {
339 'localizable' => FALSE,
341 'sig' => 'civicrm_tag::1::name',
344 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables
::multilingualize(__CLASS__
, $indices) : $indices;