Translate description in DAO files
[civicrm-core.git] / CRM / Core / DAO / EntityTag.php
CommitLineData
e501603b 1<?php
c3fc2621 2
e501603b
TO
3/**
4 * @package CRM
8c9251b3 5 * @copyright CiviCRM LLC (c) 2004-2018
e501603b
TO
6 *
7 * Generated from xml/schema/CRM/Core/EntityTag.xml
8 * DO NOT EDIT. Generated by CRM_Core_CodeGen
e7a6b91a 9 * (GenCodeChecksum:cb9ae7d6e83dd7423a431498f8dee5c8)
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 */
22 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 */
c3fc2621
CW
29 static $_log = TRUE;
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
TO
74 if (!isset(Civi::$statics[__CLASS__]['links'])) {
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,
522a26c9 97 'table_name' => 'civicrm_entity_tag',
98 'entity' => 'EntityTag',
99 'bao' => 'CRM_Core_BAO_EntityTag',
6a7e5e5d 100 'localizable' => 0,
c3fc2621
CW
101 ],
102 'entity_table' => [
e501603b
TO
103 'name' => 'entity_table',
104 'type' => CRM_Utils_Type::T_STRING,
c3fc2621 105 'title' => ts('Entity Table'),
215b423e 106 'description' => ts('physical tablename for entity being joined to file, e.g. civicrm_contact'),
e501603b
TO
107 'maxlength' => 64,
108 'size' => CRM_Utils_Type::BIG,
522a26c9 109 'table_name' => 'civicrm_entity_tag',
110 'entity' => 'EntityTag',
111 'bao' => 'CRM_Core_BAO_EntityTag',
6a7e5e5d 112 'localizable' => 0,
c3fc2621 113 'pseudoconstant' => [
e501603b
TO
114 'optionGroupName' => 'tag_used_for',
115 'optionEditPath' => 'civicrm/admin/options/tag_used_for',
c3fc2621
CW
116 ]
117 ],
118 'entity_id' => [
e501603b
TO
119 'name' => 'entity_id',
120 'type' => CRM_Utils_Type::T_INT,
c3fc2621 121 'title' => ts('Entity ID'),
215b423e 122 'description' => ts('FK to entity table specified in entity_table column.'),
c3fc2621 123 'required' => TRUE,
522a26c9 124 'table_name' => 'civicrm_entity_tag',
125 'entity' => 'EntityTag',
126 'bao' => 'CRM_Core_BAO_EntityTag',
6a7e5e5d 127 'localizable' => 0,
c3fc2621
CW
128 ],
129 'tag_id' => [
e501603b
TO
130 'name' => 'tag_id',
131 'type' => CRM_Utils_Type::T_INT,
c3fc2621 132 'title' => ts('Tag'),
215b423e 133 'description' => ts('FK to civicrm_tag'),
c3fc2621 134 'required' => TRUE,
522a26c9 135 'table_name' => 'civicrm_entity_tag',
136 'entity' => 'EntityTag',
137 'bao' => 'CRM_Core_BAO_EntityTag',
6a7e5e5d 138 'localizable' => 0,
e501603b 139 'FKClassName' => 'CRM_Core_DAO_Tag',
c3fc2621 140 'html' => [
e501603b 141 'type' => 'Select',
c3fc2621
CW
142 ],
143 'pseudoconstant' => [
e501603b
TO
144 'table' => 'civicrm_tag',
145 'keyColumn' => 'id',
146 'labelColumn' => 'name',
c3fc2621
CW
147 ]
148 ],
149 ];
346aaaba 150 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']);
e501603b 151 }
346aaaba 152 return Civi::$statics[__CLASS__]['fields'];
e501603b 153 }
c3fc2621 154
e501603b 155 /**
bd8e0b14 156 * Return a mapping from field-name to the corresponding key (as used in fields()).
e501603b
TO
157 *
158 * @return array
bd8e0b14 159 * Array(string $name => string $uniqueName).
e501603b 160 */
c3fc2621 161 public static function &fieldKeys() {
bd8e0b14
TO
162 if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) {
163 Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields()));
e501603b 164 }
bd8e0b14 165 return Civi::$statics[__CLASS__]['fieldKeys'];
e501603b 166 }
c3fc2621 167
e501603b
TO
168 /**
169 * Returns the names of this table
170 *
171 * @return string
172 */
c3fc2621 173 public static function getTableName() {
e501603b
TO
174 return self::$_tableName;
175 }
c3fc2621 176
e501603b
TO
177 /**
178 * Returns if this table needs to be logged
179 *
c3fc2621 180 * @return bool
e501603b 181 */
c3fc2621 182 public function getLog() {
e501603b
TO
183 return self::$_log;
184 }
c3fc2621 185
e501603b
TO
186 /**
187 * Returns the list of fields that can be imported
188 *
189 * @param bool $prefix
190 *
191 * @return array
192 */
c3fc2621
CW
193 public static function &import($prefix = FALSE) {
194 $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'entity_tag', $prefix, []);
60808919 195 return $r;
e501603b 196 }
c3fc2621 197
e501603b
TO
198 /**
199 * Returns the list of fields that can be exported
200 *
201 * @param bool $prefix
202 *
203 * @return array
204 */
c3fc2621
CW
205 public static function &export($prefix = FALSE) {
206 $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'entity_tag', $prefix, []);
60808919 207 return $r;
e501603b 208 }
c3fc2621 209
e7a6b91a
AS
210 /**
211 * Returns the list of indices
c3fc2621
CW
212 *
213 * @param bool $localize
214 *
215 * @return array
e7a6b91a
AS
216 */
217 public static function indices($localize = TRUE) {
c3fc2621
CW
218 $indices = [
219 'UI_entity_id_entity_table_tag_id' => [
e7a6b91a 220 'name' => 'UI_entity_id_entity_table_tag_id',
c3fc2621 221 'field' => [
e7a6b91a
AS
222 0 => 'entity_id',
223 1 => 'entity_table',
224 2 => 'tag_id',
c3fc2621
CW
225 ],
226 'localizable' => FALSE,
227 'unique' => TRUE,
e7a6b91a 228 'sig' => 'civicrm_entity_tag::1::entity_id::entity_table::tag_id',
c3fc2621
CW
229 ],
230 ];
e7a6b91a
AS
231 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices;
232 }
c3fc2621 233
e501603b 234}