5 * @copyright CiviCRM LLC https://civicrm.org/licensing
7 * Generated from xml/schema/CRM/Core/EntityTag.xml
8 * DO NOT EDIT. Generated by CRM_Core_CodeGen
9 * (GenCodeChecksum:3f4e098850d5540fb6ddd3e04d0084fe)
13 * Database access object for the EntityTag entity.
15 class CRM_Core_DAO_EntityTag
extends CRM_Core_DAO
{
18 * Static instance to hold the table name.
22 public static $_tableName = 'civicrm_entity_tag';
25 * Should CiviCRM log any modifications to this table in the civicrm_log table.
29 public static $_log = TRUE;
39 * physical tablename for entity being joined to file, e.g. civicrm_contact
46 * FK to entity table specified in entity_table column.
62 public function __construct() {
63 $this->__table
= 'civicrm_entity_tag';
64 parent
::__construct();
68 * Returns localized title of this entity.
70 public static function getEntityTitle() {
71 return ts('Entity Tags');
75 * Returns foreign keys and entity references.
78 * [CRM_Core_Reference_Interface]
80 public static function getReferenceColumns() {
81 if (!isset(Civi
::$statics[__CLASS__
]['links'])) {
82 Civi
::$statics[__CLASS__
]['links'] = static::createReferenceColumns(__CLASS__
);
83 Civi
::$statics[__CLASS__
]['links'][] = new CRM_Core_Reference_Basic(self
::getTableName(), 'tag_id', 'civicrm_tag', 'id');
84 Civi
::$statics[__CLASS__
]['links'][] = new CRM_Core_Reference_Dynamic(self
::getTableName(), 'entity_id', NULL, 'id', 'entity_table');
85 CRM_Core_DAO_AllCoreTables
::invoke(__CLASS__
, 'links_callback', Civi
::$statics[__CLASS__
]['links']);
87 return Civi
::$statics[__CLASS__
]['links'];
91 * Returns all the column names of this table
95 public static function &fields() {
96 if (!isset(Civi
::$statics[__CLASS__
]['fields'])) {
97 Civi
::$statics[__CLASS__
]['fields'] = [
100 'type' => CRM_Utils_Type
::T_INT
,
101 'title' => ts('Entity Tag ID'),
102 'description' => ts('primary key'),
104 'where' => 'civicrm_entity_tag.id',
105 'table_name' => 'civicrm_entity_tag',
106 'entity' => 'EntityTag',
107 'bao' => 'CRM_Core_BAO_EntityTag',
112 'name' => 'entity_table',
113 'type' => CRM_Utils_Type
::T_STRING
,
114 'title' => ts('Entity Table'),
115 'description' => ts('physical tablename for entity being joined to file, e.g. civicrm_contact'),
117 'size' => CRM_Utils_Type
::BIG
,
118 'where' => 'civicrm_entity_tag.entity_table',
119 'table_name' => 'civicrm_entity_tag',
120 'entity' => 'EntityTag',
121 'bao' => 'CRM_Core_BAO_EntityTag',
123 'pseudoconstant' => [
124 'optionGroupName' => 'tag_used_for',
125 'optionEditPath' => 'civicrm/admin/options/tag_used_for',
130 'name' => 'entity_id',
131 'type' => CRM_Utils_Type
::T_INT
,
132 'title' => ts('Entity ID'),
133 'description' => ts('FK to entity table specified in entity_table column.'),
135 'where' => 'civicrm_entity_tag.entity_id',
136 'table_name' => 'civicrm_entity_tag',
137 'entity' => 'EntityTag',
138 'bao' => 'CRM_Core_BAO_EntityTag',
144 'type' => CRM_Utils_Type
::T_INT
,
145 'title' => ts('Tag'),
146 'description' => ts('FK to civicrm_tag'),
148 'where' => 'civicrm_entity_tag.tag_id',
149 'table_name' => 'civicrm_entity_tag',
150 'entity' => 'EntityTag',
151 'bao' => 'CRM_Core_BAO_EntityTag',
153 'FKClassName' => 'CRM_Core_DAO_Tag',
157 'pseudoconstant' => [
158 'table' => 'civicrm_tag',
160 'labelColumn' => 'name',
165 CRM_Core_DAO_AllCoreTables
::invoke(__CLASS__
, 'fields_callback', Civi
::$statics[__CLASS__
]['fields']);
167 return Civi
::$statics[__CLASS__
]['fields'];
171 * Return a mapping from field-name to the corresponding key (as used in fields()).
174 * Array(string $name => string $uniqueName).
176 public static function &fieldKeys() {
177 if (!isset(Civi
::$statics[__CLASS__
]['fieldKeys'])) {
178 Civi
::$statics[__CLASS__
]['fieldKeys'] = array_flip(CRM_Utils_Array
::collect('name', self
::fields()));
180 return Civi
::$statics[__CLASS__
]['fieldKeys'];
184 * Returns the names of this table
188 public static function getTableName() {
189 return self
::$_tableName;
193 * Returns if this table needs to be logged
197 public function getLog() {
202 * Returns the list of fields that can be imported
204 * @param bool $prefix
208 public static function &import($prefix = FALSE) {
209 $r = CRM_Core_DAO_AllCoreTables
::getImports(__CLASS__
, 'entity_tag', $prefix, []);
214 * Returns the list of fields that can be exported
216 * @param bool $prefix
220 public static function &export($prefix = FALSE) {
221 $r = CRM_Core_DAO_AllCoreTables
::getExports(__CLASS__
, 'entity_tag', $prefix, []);
226 * Returns the list of indices
228 * @param bool $localize
232 public static function indices($localize = TRUE) {
234 'UI_entity_id_entity_table_tag_id' => [
235 'name' => 'UI_entity_id_entity_table_tag_id',
241 'localizable' => FALSE,
243 'sig' => 'civicrm_entity_tag::1::entity_id::entity_table::tag_id',
246 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables
::multilingualize(__CLASS__
, $indices) : $indices;