5 * @copyright CiviCRM LLC (c) 2004-2018
7 * Generated from xml/schema/CRM/Core/EntityTag.xml
8 * DO NOT EDIT. Generated by CRM_Core_CodeGen
9 * (GenCodeChecksum:cb9ae7d6e83dd7423a431498f8dee5c8)
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 static $_tableName = 'civicrm_entity_tag';
25 * Should CiviCRM log any modifications to this table in the civicrm_log table.
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 foreign keys and entity references.
71 * [CRM_Core_Reference_Interface]
73 public static function getReferenceColumns() {
74 if (!isset(Civi
::$statics[__CLASS__
]['links'])) {
75 Civi
::$statics[__CLASS__
]['links'] = static ::createReferenceColumns(__CLASS__
);
76 Civi
::$statics[__CLASS__
]['links'][] = new CRM_Core_Reference_Basic(self
::getTableName(), 'tag_id', 'civicrm_tag', 'id');
77 Civi
::$statics[__CLASS__
]['links'][] = new CRM_Core_Reference_Dynamic(self
::getTableName(), 'entity_id', NULL, 'id', 'entity_table');
78 CRM_Core_DAO_AllCoreTables
::invoke(__CLASS__
, 'links_callback', Civi
::$statics[__CLASS__
]['links']);
80 return Civi
::$statics[__CLASS__
]['links'];
84 * Returns all the column names of this table
88 public static function &fields() {
89 if (!isset(Civi
::$statics[__CLASS__
]['fields'])) {
90 Civi
::$statics[__CLASS__
]['fields'] = [
93 'type' => CRM_Utils_Type
::T_INT
,
94 'title' => ts('Entity Tag ID'),
95 'description' => 'primary key',
97 'table_name' => 'civicrm_entity_tag',
98 'entity' => 'EntityTag',
99 'bao' => 'CRM_Core_BAO_EntityTag',
103 'name' => 'entity_table',
104 'type' => CRM_Utils_Type
::T_STRING
,
105 'title' => ts('Entity Table'),
106 'description' => 'physical tablename for entity being joined to file, e.g. civicrm_contact',
108 'size' => CRM_Utils_Type
::BIG
,
109 'table_name' => 'civicrm_entity_tag',
110 'entity' => 'EntityTag',
111 'bao' => 'CRM_Core_BAO_EntityTag',
113 'pseudoconstant' => [
114 'optionGroupName' => 'tag_used_for',
115 'optionEditPath' => 'civicrm/admin/options/tag_used_for',
119 'name' => 'entity_id',
120 'type' => CRM_Utils_Type
::T_INT
,
121 'title' => ts('Entity ID'),
122 'description' => 'FK to entity table specified in entity_table column.',
124 'table_name' => 'civicrm_entity_tag',
125 'entity' => 'EntityTag',
126 'bao' => 'CRM_Core_BAO_EntityTag',
131 'type' => CRM_Utils_Type
::T_INT
,
132 'title' => ts('Tag'),
133 'description' => 'FK to civicrm_tag',
135 'table_name' => 'civicrm_entity_tag',
136 'entity' => 'EntityTag',
137 'bao' => 'CRM_Core_BAO_EntityTag',
139 'FKClassName' => 'CRM_Core_DAO_Tag',
143 'pseudoconstant' => [
144 'table' => 'civicrm_tag',
146 'labelColumn' => 'name',
150 CRM_Core_DAO_AllCoreTables
::invoke(__CLASS__
, 'fields_callback', Civi
::$statics[__CLASS__
]['fields']);
152 return Civi
::$statics[__CLASS__
]['fields'];
156 * Return a mapping from field-name to the corresponding key (as used in fields()).
159 * Array(string $name => string $uniqueName).
161 public static function &fieldKeys() {
162 if (!isset(Civi
::$statics[__CLASS__
]['fieldKeys'])) {
163 Civi
::$statics[__CLASS__
]['fieldKeys'] = array_flip(CRM_Utils_Array
::collect('name', self
::fields()));
165 return Civi
::$statics[__CLASS__
]['fieldKeys'];
169 * Returns the names of this table
173 public static function getTableName() {
174 return self
::$_tableName;
178 * Returns if this table needs to be logged
182 public function getLog() {
187 * Returns the list of fields that can be imported
189 * @param bool $prefix
193 public static function &import($prefix = FALSE) {
194 $r = CRM_Core_DAO_AllCoreTables
::getImports(__CLASS__
, 'entity_tag', $prefix, []);
199 * Returns the list of fields that can be exported
201 * @param bool $prefix
205 public static function &export($prefix = FALSE) {
206 $r = CRM_Core_DAO_AllCoreTables
::getExports(__CLASS__
, 'entity_tag', $prefix, []);
211 * Returns the list of indices
213 * @param bool $localize
217 public static function indices($localize = TRUE) {
219 'UI_entity_id_entity_table_tag_id' => [
220 'name' => 'UI_entity_id_entity_table_tag_id',
226 'localizable' => FALSE,
228 'sig' => 'civicrm_entity_tag::1::entity_id::entity_table::tag_id',
231 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables
::multilingualize(__CLASS__
, $indices) : $indices;