Make phpType definitions in generated DAO objects more accurate.
[civicrm-core.git] / CRM / Core / DAO / Translation.php
CommitLineData
fd1ea018
TO
1<?php
2
3/**
4 * @package CRM
5 * @copyright CiviCRM LLC https://civicrm.org/licensing
6 *
7 * Generated from xml/schema/CRM/Core/Translation.xml
8 * DO NOT EDIT. Generated by CRM_Core_CodeGen
2562d09a 9 * (GenCodeChecksum:26a0aec7a4d0e31684a513f1a3f6fa18)
fd1ea018
TO
10 */
11
12/**
13 * Database access object for the Translation entity.
14 */
15class CRM_Core_DAO_Translation extends CRM_Core_DAO {
16 const EXT = 'civicrm';
17 const TABLE_ADDED = '5.39';
18
19 /**
20 * Static instance to hold the table name.
21 *
22 * @var string
23 */
24 public static $_tableName = 'civicrm_translation';
25
26 /**
27 * Should CiviCRM log any modifications to this table in the civicrm_log table.
28 *
29 * @var bool
30 */
31 public static $_log = TRUE;
32
33 /**
34 * Unique String ID
35 *
36 * @var int
37 */
38 public $id;
39
40 /**
41 * Table where referenced item is stored
42 *
43 * @var string
44 */
45 public $entity_table;
46
47 /**
48 * Field where referenced item is stored
49 *
50 * @var string
51 */
52 public $entity_field;
53
54 /**
55 * ID of the relevant entity.
56 *
57 * @var int
58 */
59 public $entity_id;
60
61 /**
62 * Relevant language
63 *
64 * @var string
65 */
66 public $language;
67
68 /**
69 * Specify whether the string is active, draft, etc
70 *
71 * @var int
72 */
73 public $status_id;
74
75 /**
76 * Translated string
77 *
78 * @var longtext
79 */
80 public $string;
81
82 /**
83 * Class constructor.
84 */
85 public function __construct() {
86 $this->__table = 'civicrm_translation';
87 parent::__construct();
88 }
89
90 /**
91 * Returns localized title of this entity.
92 *
93 * @param bool $plural
94 * Whether to return the plural version of the title.
95 */
96 public static function getEntityTitle($plural = FALSE) {
97 return $plural ? ts('Translated Strings') : ts('Translated String');
98 }
99
100 /**
101 * Returns foreign keys and entity references.
102 *
103 * @return array
104 * [CRM_Core_Reference_Interface]
105 */
106 public static function getReferenceColumns() {
107 if (!isset(Civi::$statics[__CLASS__]['links'])) {
108 Civi::$statics[__CLASS__]['links'] = static::createReferenceColumns(__CLASS__);
109 Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Dynamic(self::getTableName(), 'entity_id', NULL, 'id', 'entity_table');
110 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'links_callback', Civi::$statics[__CLASS__]['links']);
111 }
112 return Civi::$statics[__CLASS__]['links'];
113 }
114
115 /**
116 * Returns all the column names of this table
117 *
118 * @return array
119 */
120 public static function &fields() {
121 if (!isset(Civi::$statics[__CLASS__]['fields'])) {
122 Civi::$statics[__CLASS__]['fields'] = [
123 'id' => [
124 'name' => 'id',
125 'type' => CRM_Utils_Type::T_INT,
9fa6bb0b 126 'title' => ts('Translated String ID'),
fd1ea018
TO
127 'description' => ts('Unique String ID'),
128 'required' => TRUE,
129 'where' => 'civicrm_translation.id',
130 'table_name' => 'civicrm_translation',
131 'entity' => 'Translation',
9fa6bb0b 132 'bao' => 'CRM_Core_BAO_Translation',
fd1ea018
TO
133 'localizable' => 0,
134 'readonly' => TRUE,
135 'add' => '5.39',
136 ],
137 'entity_table' => [
138 'name' => 'entity_table',
139 'type' => CRM_Utils_Type::T_STRING,
9fa6bb0b 140 'title' => ts('Translated Entity'),
fd1ea018
TO
141 'description' => ts('Table where referenced item is stored'),
142 'required' => TRUE,
143 'maxlength' => 64,
144 'size' => CRM_Utils_Type::BIG,
145 'where' => 'civicrm_translation.entity_table',
146 'table_name' => 'civicrm_translation',
147 'entity' => 'Translation',
9fa6bb0b 148 'bao' => 'CRM_Core_BAO_Translation',
fd1ea018
TO
149 'localizable' => 0,
150 'pseudoconstant' => [
151 'callback' => 'CRM_Core_BAO_Translation::getEntityTables',
152 ],
153 'add' => '5.39',
154 ],
155 'entity_field' => [
156 'name' => 'entity_field',
157 'type' => CRM_Utils_Type::T_STRING,
9fa6bb0b 158 'title' => ts('Translated Field'),
fd1ea018
TO
159 'description' => ts('Field where referenced item is stored'),
160 'required' => TRUE,
161 'maxlength' => 64,
162 'size' => CRM_Utils_Type::BIG,
163 'where' => 'civicrm_translation.entity_field',
164 'table_name' => 'civicrm_translation',
165 'entity' => 'Translation',
9fa6bb0b 166 'bao' => 'CRM_Core_BAO_Translation',
fd1ea018
TO
167 'localizable' => 0,
168 'pseudoconstant' => [
169 'callback' => 'CRM_Core_BAO_Translation::getEntityFields',
170 ],
171 'add' => '5.39',
172 ],
173 'entity_id' => [
174 'name' => 'entity_id',
175 'type' => CRM_Utils_Type::T_INT,
9fa6bb0b 176 'title' => ts('Translated Entity ID'),
fd1ea018
TO
177 'description' => ts('ID of the relevant entity.'),
178 'required' => TRUE,
179 'where' => 'civicrm_translation.entity_id',
180 'table_name' => 'civicrm_translation',
181 'entity' => 'Translation',
9fa6bb0b 182 'bao' => 'CRM_Core_BAO_Translation',
fd1ea018
TO
183 'localizable' => 0,
184 'add' => '5.39',
185 ],
186 'language' => [
187 'name' => 'language',
188 'type' => CRM_Utils_Type::T_STRING,
189 'title' => ts('Language'),
190 'description' => ts('Relevant language'),
191 'required' => TRUE,
192 'maxlength' => 5,
193 'size' => CRM_Utils_Type::SIX,
194 'where' => 'civicrm_translation.language',
195 'table_name' => 'civicrm_translation',
196 'entity' => 'Translation',
9fa6bb0b 197 'bao' => 'CRM_Core_BAO_Translation',
fd1ea018
TO
198 'localizable' => 0,
199 'html' => [
200 'type' => 'Select',
201 ],
202 'pseudoconstant' => [
203 'optionGroupName' => 'languages',
204 'keyColumn' => 'name',
205 'optionEditPath' => 'civicrm/admin/options/languages',
206 ],
207 'add' => '5.39',
208 ],
209 'status_id' => [
210 'name' => 'status_id',
211 'type' => CRM_Utils_Type::T_INT,
9fa6bb0b 212 'title' => ts('Status'),
fd1ea018
TO
213 'description' => ts('Specify whether the string is active, draft, etc'),
214 'required' => TRUE,
215 'where' => 'civicrm_translation.status_id',
216 'default' => '1',
217 'table_name' => 'civicrm_translation',
218 'entity' => 'Translation',
9fa6bb0b 219 'bao' => 'CRM_Core_BAO_Translation',
fd1ea018
TO
220 'localizable' => 0,
221 'pseudoconstant' => [
222 'callback' => 'CRM_Core_BAO_Translation::getStatuses',
223 ],
224 'add' => '5.39',
225 ],
226 'string' => [
227 'name' => 'string',
228 'type' => CRM_Utils_Type::T_LONGTEXT,
9fa6bb0b 229 'title' => ts('Translated String'),
fd1ea018
TO
230 'description' => ts('Translated string'),
231 'required' => TRUE,
232 'where' => 'civicrm_translation.string',
233 'table_name' => 'civicrm_translation',
234 'entity' => 'Translation',
9fa6bb0b 235 'bao' => 'CRM_Core_BAO_Translation',
fd1ea018
TO
236 'localizable' => 0,
237 'add' => '5.39',
238 ],
239 ];
240 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']);
241 }
242 return Civi::$statics[__CLASS__]['fields'];
243 }
244
245 /**
246 * Return a mapping from field-name to the corresponding key (as used in fields()).
247 *
248 * @return array
249 * Array(string $name => string $uniqueName).
250 */
251 public static function &fieldKeys() {
252 if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) {
253 Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields()));
254 }
255 return Civi::$statics[__CLASS__]['fieldKeys'];
256 }
257
258 /**
259 * Returns the names of this table
260 *
261 * @return string
262 */
263 public static function getTableName() {
264 return self::$_tableName;
265 }
266
267 /**
268 * Returns if this table needs to be logged
269 *
270 * @return bool
271 */
272 public function getLog() {
273 return self::$_log;
274 }
275
276 /**
277 * Returns the list of fields that can be imported
278 *
279 * @param bool $prefix
280 *
281 * @return array
282 */
283 public static function &import($prefix = FALSE) {
284 $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'translation', $prefix, []);
285 return $r;
286 }
287
288 /**
289 * Returns the list of fields that can be exported
290 *
291 * @param bool $prefix
292 *
293 * @return array
294 */
295 public static function &export($prefix = FALSE) {
296 $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'translation', $prefix, []);
297 return $r;
298 }
299
300 /**
301 * Returns the list of indices
302 *
303 * @param bool $localize
304 *
305 * @return array
306 */
307 public static function indices($localize = TRUE) {
308 $indices = [
309 'index_entity_lang' => [
310 'name' => 'index_entity_lang',
311 'field' => [
312 0 => 'entity_id',
313 1 => 'entity_table',
314 2 => 'language',
315 ],
316 'localizable' => FALSE,
317 'sig' => 'civicrm_translation::0::entity_id::entity_table::language',
318 ],
319 ];
320 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices;
321 }
322
323}