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:8c816585b0863674074b4aaf5c644cab)
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',
187 'name' => 'is_selectable',
188 'type' => CRM_Utils_Type
::T_BOOLEAN
,
189 'title' => ts('Display Tag?'),
190 'description' => ts('Is this tag selectable / displayed'),
191 'where' => 'civicrm_tag.is_selectable',
193 'table_name' => 'civicrm_tag',
195 'bao' => 'CRM_Core_BAO_Tag',
199 'name' => 'is_reserved',
200 'type' => CRM_Utils_Type
::T_BOOLEAN
,
201 'title' => ts('Reserved'),
202 'where' => 'civicrm_tag.is_reserved',
204 'table_name' => 'civicrm_tag',
206 'bao' => 'CRM_Core_BAO_Tag',
210 'name' => 'is_tagset',
211 'type' => CRM_Utils_Type
::T_BOOLEAN
,
212 'title' => ts('Tagset'),
213 'where' => 'civicrm_tag.is_tagset',
215 'table_name' => 'civicrm_tag',
217 'bao' => 'CRM_Core_BAO_Tag',
221 'name' => 'used_for',
222 'type' => CRM_Utils_Type
::T_STRING
,
223 'title' => ts('Used For'),
225 'size' => CRM_Utils_Type
::BIG
,
226 'where' => 'civicrm_tag.used_for',
228 'table_name' => 'civicrm_tag',
230 'bao' => 'CRM_Core_BAO_Tag',
232 'serialize' => self
::SERIALIZE_COMMA
,
236 'pseudoconstant' => [
237 'optionGroupName' => 'tag_used_for',
238 'optionEditPath' => 'civicrm/admin/options/tag_used_for',
242 'name' => 'created_id',
243 'type' => CRM_Utils_Type
::T_INT
,
244 'title' => ts('Tag Created By'),
245 'description' => ts('FK to civicrm_contact, who created this tag'),
246 'where' => 'civicrm_tag.created_id',
247 'table_name' => 'civicrm_tag',
249 'bao' => 'CRM_Core_BAO_Tag',
251 'FKClassName' => 'CRM_Contact_DAO_Contact',
255 'type' => CRM_Utils_Type
::T_STRING
,
256 'title' => ts('Color'),
257 'description' => ts('Hex color value e.g. #ffffff'),
259 'size' => CRM_Utils_Type
::HUGE
,
260 'where' => 'civicrm_tag.color',
262 'table_name' => 'civicrm_tag',
264 'bao' => 'CRM_Core_BAO_Tag',
268 'name' => 'created_date',
269 'type' => CRM_Utils_Type
::T_DATE + CRM_Utils_Type
::T_TIME
,
270 'title' => ts('Tag Created Date'),
271 'description' => ts('Date and time that tag was created.'),
272 'where' => 'civicrm_tag.created_date',
273 'table_name' => 'civicrm_tag',
275 'bao' => 'CRM_Core_BAO_Tag',
279 CRM_Core_DAO_AllCoreTables
::invoke(__CLASS__
, 'fields_callback', Civi
::$statics[__CLASS__
]['fields']);
281 return Civi
::$statics[__CLASS__
]['fields'];
285 * Return a mapping from field-name to the corresponding key (as used in fields()).
288 * Array(string $name => string $uniqueName).
290 public static function &fieldKeys() {
291 if (!isset(Civi
::$statics[__CLASS__
]['fieldKeys'])) {
292 Civi
::$statics[__CLASS__
]['fieldKeys'] = array_flip(CRM_Utils_Array
::collect('name', self
::fields()));
294 return Civi
::$statics[__CLASS__
]['fieldKeys'];
298 * Returns the names of this table
302 public static function getTableName() {
303 return self
::$_tableName;
307 * Returns if this table needs to be logged
311 public function getLog() {
316 * Returns the list of fields that can be imported
318 * @param bool $prefix
322 public static function &import($prefix = FALSE) {
323 $r = CRM_Core_DAO_AllCoreTables
::getImports(__CLASS__
, 'tag', $prefix, []);
328 * Returns the list of fields that can be exported
330 * @param bool $prefix
334 public static function &export($prefix = FALSE) {
335 $r = CRM_Core_DAO_AllCoreTables
::getExports(__CLASS__
, 'tag', $prefix, []);
340 * Returns the list of indices
342 * @param bool $localize
346 public static function indices($localize = TRUE) {
353 'localizable' => FALSE,
355 'sig' => 'civicrm_tag::1::name',
358 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables
::multilingualize(__CLASS__
, $indices) : $indices;