Declare API Key as a protected field for future use
[civicrm-core.git] / CRM / Core / DAO / EntityTag.php
CommitLineData
e501603b 1<?php
c3fc2621 2
e501603b
TO
3/**
4 * @package CRM
6b83d5bd 5 * @copyright CiviCRM LLC (c) 2004-2019
e501603b
TO
6 *
7 * Generated from xml/schema/CRM/Core/EntityTag.xml
8 * DO NOT EDIT. Generated by CRM_Core_CodeGen
042043f1 9 * (GenCodeChecksum:5a62aa4bfd5c64e6ff7d6ee47a8360b1)
e501603b 10 */
c3fc2621 11
f41f0342 12/**
c3fc2621 13 * Database access object for the EntityTag entity.
f41f0342 14 */
e501603b 15class CRM_Core_DAO_EntityTag extends CRM_Core_DAO {
c3fc2621 16
e501603b 17 /**
f41f0342 18 * Static instance to hold the table name.
e501603b
TO
19 *
20 * @var string
21 */
fa45b5b9 22 public static $_tableName = 'civicrm_entity_tag';
c3fc2621 23
e501603b 24 /**
f41f0342 25 * Should CiviCRM log any modifications to this table in the civicrm_log table.
e501603b 26 *
c3fc2621 27 * @var bool
e501603b 28 */
fa45b5b9 29 public static $_log = TRUE;
c3fc2621 30
e501603b
TO
31 /**
32 * primary key
33 *
34 * @var int unsigned
35 */
36 public $id;
c3fc2621 37
e501603b
TO
38 /**
39 * physical tablename for entity being joined to file, e.g. civicrm_contact
40 *
41 * @var string
42 */
43 public $entity_table;
c3fc2621 44
e501603b
TO
45 /**
46 * FK to entity table specified in entity_table column.
47 *
48 * @var int unsigned
49 */
50 public $entity_id;
c3fc2621 51
e501603b
TO
52 /**
53 * FK to civicrm_tag
54 *
55 * @var int unsigned
56 */
57 public $tag_id;
c3fc2621 58
e501603b 59 /**
f41f0342 60 * Class constructor.
e501603b 61 */
c3fc2621 62 public function __construct() {
e501603b
TO
63 $this->__table = 'civicrm_entity_tag';
64 parent::__construct();
65 }
c3fc2621 66
e501603b 67 /**
f41f0342 68 * Returns foreign keys and entity references.
e501603b
TO
69 *
70 * @return array
71 * [CRM_Core_Reference_Interface]
72 */
c3fc2621 73 public static function getReferenceColumns() {
346aaaba 74 if (!isset(Civi::$statics[__CLASS__]['links'])) {
fa45b5b9 75 Civi::$statics[__CLASS__]['links'] = static::createReferenceColumns(__CLASS__);
c3fc2621
CW
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');
346aaaba 78 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'links_callback', Civi::$statics[__CLASS__]['links']);
e501603b 79 }
346aaaba 80 return Civi::$statics[__CLASS__]['links'];
e501603b 81 }
c3fc2621 82
e501603b
TO
83 /**
84 * Returns all the column names of this table
85 *
86 * @return array
87 */
c3fc2621 88 public static function &fields() {
346aaaba 89 if (!isset(Civi::$statics[__CLASS__]['fields'])) {
c3fc2621
CW
90 Civi::$statics[__CLASS__]['fields'] = [
91 'id' => [
e501603b
TO
92 'name' => 'id',
93 'type' => CRM_Utils_Type::T_INT,
c3fc2621 94 'title' => ts('Entity Tag ID'),
215b423e 95 'description' => ts('primary key'),
c3fc2621 96 'required' => TRUE,
a36434b9 97 'where' => 'civicrm_entity_tag.id',
522a26c9 98 'table_name' => 'civicrm_entity_tag',
99 'entity' => 'EntityTag',
100 'bao' => 'CRM_Core_BAO_EntityTag',
6a7e5e5d 101 'localizable' => 0,
c3fc2621
CW
102 ],
103 'entity_table' => [
e501603b
TO
104 'name' => 'entity_table',
105 'type' => CRM_Utils_Type::T_STRING,
c3fc2621 106 'title' => ts('Entity Table'),
215b423e 107 'description' => ts('physical tablename for entity being joined to file, e.g. civicrm_contact'),
e501603b
TO
108 'maxlength' => 64,
109 'size' => CRM_Utils_Type::BIG,
a36434b9 110 'where' => 'civicrm_entity_tag.entity_table',
522a26c9 111 'table_name' => 'civicrm_entity_tag',
112 'entity' => 'EntityTag',
113 'bao' => 'CRM_Core_BAO_EntityTag',
6a7e5e5d 114 'localizable' => 0,
c3fc2621 115 'pseudoconstant' => [
e501603b
TO
116 'optionGroupName' => 'tag_used_for',
117 'optionEditPath' => 'civicrm/admin/options/tag_used_for',
c3fc2621
CW
118 ]
119 ],
120 'entity_id' => [
e501603b
TO
121 'name' => 'entity_id',
122 'type' => CRM_Utils_Type::T_INT,
c3fc2621 123 'title' => ts('Entity ID'),
215b423e 124 'description' => ts('FK to entity table specified in entity_table column.'),
c3fc2621 125 'required' => TRUE,
a36434b9 126 'where' => 'civicrm_entity_tag.entity_id',
522a26c9 127 'table_name' => 'civicrm_entity_tag',
128 'entity' => 'EntityTag',
129 'bao' => 'CRM_Core_BAO_EntityTag',
6a7e5e5d 130 'localizable' => 0,
c3fc2621
CW
131 ],
132 'tag_id' => [
e501603b
TO
133 'name' => 'tag_id',
134 'type' => CRM_Utils_Type::T_INT,
c3fc2621 135 'title' => ts('Tag'),
215b423e 136 'description' => ts('FK to civicrm_tag'),
c3fc2621 137 'required' => TRUE,
a36434b9 138 'where' => 'civicrm_entity_tag.tag_id',
522a26c9 139 'table_name' => 'civicrm_entity_tag',
140 'entity' => 'EntityTag',
141 'bao' => 'CRM_Core_BAO_EntityTag',
6a7e5e5d 142 'localizable' => 0,
e501603b 143 'FKClassName' => 'CRM_Core_DAO_Tag',
c3fc2621 144 'html' => [
e501603b 145 'type' => 'Select',
c3fc2621
CW
146 ],
147 'pseudoconstant' => [
e501603b
TO
148 'table' => 'civicrm_tag',
149 'keyColumn' => 'id',
150 'labelColumn' => 'name',
c3fc2621
CW
151 ]
152 ],
153 ];
346aaaba 154 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']);
e501603b 155 }
346aaaba 156 return Civi::$statics[__CLASS__]['fields'];
e501603b 157 }
c3fc2621 158
e501603b 159 /**
bd8e0b14 160 * Return a mapping from field-name to the corresponding key (as used in fields()).
e501603b
TO
161 *
162 * @return array
bd8e0b14 163 * Array(string $name => string $uniqueName).
e501603b 164 */
c3fc2621 165 public static function &fieldKeys() {
bd8e0b14
TO
166 if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) {
167 Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields()));
e501603b 168 }
bd8e0b14 169 return Civi::$statics[__CLASS__]['fieldKeys'];
e501603b 170 }
c3fc2621 171
e501603b
TO
172 /**
173 * Returns the names of this table
174 *
175 * @return string
176 */
c3fc2621 177 public static function getTableName() {
e501603b
TO
178 return self::$_tableName;
179 }
c3fc2621 180
e501603b
TO
181 /**
182 * Returns if this table needs to be logged
183 *
c3fc2621 184 * @return bool
e501603b 185 */
c3fc2621 186 public function getLog() {
e501603b
TO
187 return self::$_log;
188 }
c3fc2621 189
e501603b
TO
190 /**
191 * Returns the list of fields that can be imported
192 *
193 * @param bool $prefix
194 *
195 * @return array
196 */
c3fc2621
CW
197 public static function &import($prefix = FALSE) {
198 $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'entity_tag', $prefix, []);
60808919 199 return $r;
e501603b 200 }
c3fc2621 201
e501603b
TO
202 /**
203 * Returns the list of fields that can be exported
204 *
205 * @param bool $prefix
206 *
207 * @return array
208 */
c3fc2621
CW
209 public static function &export($prefix = FALSE) {
210 $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'entity_tag', $prefix, []);
60808919 211 return $r;
e501603b 212 }
c3fc2621 213
e7a6b91a
AS
214 /**
215 * Returns the list of indices
c3fc2621
CW
216 *
217 * @param bool $localize
218 *
219 * @return array
e7a6b91a
AS
220 */
221 public static function indices($localize = TRUE) {
c3fc2621
CW
222 $indices = [
223 'UI_entity_id_entity_table_tag_id' => [
e7a6b91a 224 'name' => 'UI_entity_id_entity_table_tag_id',
c3fc2621 225 'field' => [
e7a6b91a
AS
226 0 => 'entity_id',
227 1 => 'entity_table',
228 2 => 'tag_id',
c3fc2621
CW
229 ],
230 'localizable' => FALSE,
231 'unique' => TRUE,
e7a6b91a 232 'sig' => 'civicrm_entity_tag::1::entity_id::entity_table::tag_id',
c3fc2621
CW
233 ],
234 ];
e7a6b91a
AS
235 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices;
236 }
c3fc2621 237
e501603b 238}