5 * @copyright CiviCRM LLC https://civicrm.org/licensing
7 * Generated from xml/schema/CRM/Core/Translation.xml
8 * DO NOT EDIT. Generated by CRM_Core_CodeGen
9 * (GenCodeChecksum:f0f986e6ba50631d51e09da061eb494a)
13 * Database access object for the Translation entity.
15 class CRM_Core_DAO_Translation
extends CRM_Core_DAO
{
16 const EXT
= 'civicrm';
17 const TABLE_ADDED
= '5.39';
20 * Static instance to hold the table name.
24 public static $_tableName = 'civicrm_translation';
27 * Should CiviCRM log any modifications to this table in the civicrm_log table.
31 public static $_log = TRUE;
36 * @var int|string|null
37 * (SQL type: int unsigned)
38 * Note that values will be retrieved from the database as a string.
43 * Table where referenced item is stored
46 * (SQL type: varchar(64))
47 * Note that values will be retrieved from the database as a string.
52 * Field where referenced item is stored
55 * (SQL type: varchar(64))
56 * Note that values will be retrieved from the database as a string.
61 * ID of the relevant entity.
65 * Note that values will be retrieved from the database as a string.
73 * (SQL type: varchar(5))
74 * Note that values will be retrieved from the database as a string.
79 * Specify whether the string is active, draft, etc
83 * Note that values will be retrieved from the database as a string.
91 * (SQL type: longtext)
92 * Note that values will be retrieved from the database as a string.
99 public function __construct() {
100 $this->__table
= 'civicrm_translation';
101 parent
::__construct();
105 * Returns localized title of this entity.
107 * @param bool $plural
108 * Whether to return the plural version of the title.
110 public static function getEntityTitle($plural = FALSE) {
111 return $plural ?
ts('Translated Strings') : ts('Translated String');
115 * Returns foreign keys and entity references.
118 * [CRM_Core_Reference_Interface]
120 public static function getReferenceColumns() {
121 if (!isset(Civi
::$statics[__CLASS__
]['links'])) {
122 Civi
::$statics[__CLASS__
]['links'] = static::createReferenceColumns(__CLASS__
);
123 Civi
::$statics[__CLASS__
]['links'][] = new CRM_Core_Reference_Dynamic(self
::getTableName(), 'entity_id', NULL, 'id', 'entity_table');
124 CRM_Core_DAO_AllCoreTables
::invoke(__CLASS__
, 'links_callback', Civi
::$statics[__CLASS__
]['links']);
126 return Civi
::$statics[__CLASS__
]['links'];
130 * Returns all the column names of this table
134 public static function &fields() {
135 if (!isset(Civi
::$statics[__CLASS__
]['fields'])) {
136 Civi
::$statics[__CLASS__
]['fields'] = [
139 'type' => CRM_Utils_Type
::T_INT
,
140 'title' => ts('Translated String ID'),
141 'description' => ts('Unique String ID'),
143 'where' => 'civicrm_translation.id',
144 'table_name' => 'civicrm_translation',
145 'entity' => 'Translation',
146 'bao' => 'CRM_Core_BAO_Translation',
152 'name' => 'entity_table',
153 'type' => CRM_Utils_Type
::T_STRING
,
154 'title' => ts('Translated Entity'),
155 'description' => ts('Table where referenced item is stored'),
158 'size' => CRM_Utils_Type
::BIG
,
159 'where' => 'civicrm_translation.entity_table',
160 'table_name' => 'civicrm_translation',
161 'entity' => 'Translation',
162 'bao' => 'CRM_Core_BAO_Translation',
164 'pseudoconstant' => [
165 'callback' => 'CRM_Core_BAO_Translation::getEntityTables',
170 'name' => 'entity_field',
171 'type' => CRM_Utils_Type
::T_STRING
,
172 'title' => ts('Translated Field'),
173 'description' => ts('Field where referenced item is stored'),
176 'size' => CRM_Utils_Type
::BIG
,
177 'where' => 'civicrm_translation.entity_field',
178 'table_name' => 'civicrm_translation',
179 'entity' => 'Translation',
180 'bao' => 'CRM_Core_BAO_Translation',
182 'pseudoconstant' => [
183 'callback' => 'CRM_Core_BAO_Translation::getEntityFields',
188 'name' => 'entity_id',
189 'type' => CRM_Utils_Type
::T_INT
,
190 'title' => ts('Translated Entity ID'),
191 'description' => ts('ID of the relevant entity.'),
193 'where' => 'civicrm_translation.entity_id',
194 'table_name' => 'civicrm_translation',
195 'entity' => 'Translation',
196 'bao' => 'CRM_Core_BAO_Translation',
201 'name' => 'language',
202 'type' => CRM_Utils_Type
::T_STRING
,
203 'title' => ts('Language'),
204 'description' => ts('Relevant language'),
207 'size' => CRM_Utils_Type
::SIX
,
208 'where' => 'civicrm_translation.language',
209 'table_name' => 'civicrm_translation',
210 'entity' => 'Translation',
211 'bao' => 'CRM_Core_BAO_Translation',
216 'pseudoconstant' => [
217 'optionGroupName' => 'languages',
218 'keyColumn' => 'name',
219 'optionEditPath' => 'civicrm/admin/options/languages',
224 'name' => 'status_id',
225 'type' => CRM_Utils_Type
::T_INT
,
226 'title' => ts('Status'),
227 'description' => ts('Specify whether the string is active, draft, etc'),
229 'where' => 'civicrm_translation.status_id',
231 'table_name' => 'civicrm_translation',
232 'entity' => 'Translation',
233 'bao' => 'CRM_Core_BAO_Translation',
235 'pseudoconstant' => [
236 'callback' => 'CRM_Core_BAO_Translation::getStatuses',
242 'type' => CRM_Utils_Type
::T_LONGTEXT
,
243 'title' => ts('Translated String'),
244 'description' => ts('Translated string'),
246 'where' => 'civicrm_translation.string',
247 'table_name' => 'civicrm_translation',
248 'entity' => 'Translation',
249 'bao' => 'CRM_Core_BAO_Translation',
254 CRM_Core_DAO_AllCoreTables
::invoke(__CLASS__
, 'fields_callback', Civi
::$statics[__CLASS__
]['fields']);
256 return Civi
::$statics[__CLASS__
]['fields'];
260 * Return a mapping from field-name to the corresponding key (as used in fields()).
263 * Array(string $name => string $uniqueName).
265 public static function &fieldKeys() {
266 if (!isset(Civi
::$statics[__CLASS__
]['fieldKeys'])) {
267 Civi
::$statics[__CLASS__
]['fieldKeys'] = array_flip(CRM_Utils_Array
::collect('name', self
::fields()));
269 return Civi
::$statics[__CLASS__
]['fieldKeys'];
273 * Returns the names of this table
277 public static function getTableName() {
278 return self
::$_tableName;
282 * Returns if this table needs to be logged
286 public function getLog() {
291 * Returns the list of fields that can be imported
293 * @param bool $prefix
297 public static function &import($prefix = FALSE) {
298 $r = CRM_Core_DAO_AllCoreTables
::getImports(__CLASS__
, 'translation', $prefix, []);
303 * Returns the list of fields that can be exported
305 * @param bool $prefix
309 public static function &export($prefix = FALSE) {
310 $r = CRM_Core_DAO_AllCoreTables
::getExports(__CLASS__
, 'translation', $prefix, []);
315 * Returns the list of indices
317 * @param bool $localize
321 public static function indices($localize = TRUE) {
323 'index_entity_lang' => [
324 'name' => 'index_entity_lang',
330 'localizable' => FALSE,
331 'sig' => 'civicrm_translation::0::entity_id::entity_table::language',
334 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables
::multilingualize(__CLASS__
, $indices) : $indices;