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:26a0aec7a4d0e31684a513f1a3f6fa18)
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;
41 * Table where referenced item is stored
48 * Field where referenced item is stored
55 * ID of the relevant entity.
69 * Specify whether the string is active, draft, etc
85 public function __construct() {
86 $this->__table
= 'civicrm_translation';
87 parent
::__construct();
91 * Returns localized title of this entity.
94 * Whether to return the plural version of the title.
96 public static function getEntityTitle($plural = FALSE) {
97 return $plural ?
ts('Translated Strings') : ts('Translated String');
101 * Returns foreign keys and entity references.
104 * [CRM_Core_Reference_Interface]
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']);
112 return Civi
::$statics[__CLASS__
]['links'];
116 * Returns all the column names of this table
120 public static function &fields() {
121 if (!isset(Civi
::$statics[__CLASS__
]['fields'])) {
122 Civi
::$statics[__CLASS__
]['fields'] = [
125 'type' => CRM_Utils_Type
::T_INT
,
126 'title' => ts('Translated String ID'),
127 'description' => ts('Unique String ID'),
129 'where' => 'civicrm_translation.id',
130 'table_name' => 'civicrm_translation',
131 'entity' => 'Translation',
132 'bao' => 'CRM_Core_BAO_Translation',
138 'name' => 'entity_table',
139 'type' => CRM_Utils_Type
::T_STRING
,
140 'title' => ts('Translated Entity'),
141 'description' => ts('Table where referenced item is stored'),
144 'size' => CRM_Utils_Type
::BIG
,
145 'where' => 'civicrm_translation.entity_table',
146 'table_name' => 'civicrm_translation',
147 'entity' => 'Translation',
148 'bao' => 'CRM_Core_BAO_Translation',
150 'pseudoconstant' => [
151 'callback' => 'CRM_Core_BAO_Translation::getEntityTables',
156 'name' => 'entity_field',
157 'type' => CRM_Utils_Type
::T_STRING
,
158 'title' => ts('Translated Field'),
159 'description' => ts('Field where referenced item is stored'),
162 'size' => CRM_Utils_Type
::BIG
,
163 'where' => 'civicrm_translation.entity_field',
164 'table_name' => 'civicrm_translation',
165 'entity' => 'Translation',
166 'bao' => 'CRM_Core_BAO_Translation',
168 'pseudoconstant' => [
169 'callback' => 'CRM_Core_BAO_Translation::getEntityFields',
174 'name' => 'entity_id',
175 'type' => CRM_Utils_Type
::T_INT
,
176 'title' => ts('Translated Entity ID'),
177 'description' => ts('ID of the relevant entity.'),
179 'where' => 'civicrm_translation.entity_id',
180 'table_name' => 'civicrm_translation',
181 'entity' => 'Translation',
182 'bao' => 'CRM_Core_BAO_Translation',
187 'name' => 'language',
188 'type' => CRM_Utils_Type
::T_STRING
,
189 'title' => ts('Language'),
190 'description' => ts('Relevant language'),
193 'size' => CRM_Utils_Type
::SIX
,
194 'where' => 'civicrm_translation.language',
195 'table_name' => 'civicrm_translation',
196 'entity' => 'Translation',
197 'bao' => 'CRM_Core_BAO_Translation',
202 'pseudoconstant' => [
203 'optionGroupName' => 'languages',
204 'keyColumn' => 'name',
205 'optionEditPath' => 'civicrm/admin/options/languages',
210 'name' => 'status_id',
211 'type' => CRM_Utils_Type
::T_INT
,
212 'title' => ts('Status'),
213 'description' => ts('Specify whether the string is active, draft, etc'),
215 'where' => 'civicrm_translation.status_id',
217 'table_name' => 'civicrm_translation',
218 'entity' => 'Translation',
219 'bao' => 'CRM_Core_BAO_Translation',
221 'pseudoconstant' => [
222 'callback' => 'CRM_Core_BAO_Translation::getStatuses',
228 'type' => CRM_Utils_Type
::T_LONGTEXT
,
229 'title' => ts('Translated String'),
230 'description' => ts('Translated string'),
232 'where' => 'civicrm_translation.string',
233 'table_name' => 'civicrm_translation',
234 'entity' => 'Translation',
235 'bao' => 'CRM_Core_BAO_Translation',
240 CRM_Core_DAO_AllCoreTables
::invoke(__CLASS__
, 'fields_callback', Civi
::$statics[__CLASS__
]['fields']);
242 return Civi
::$statics[__CLASS__
]['fields'];
246 * Return a mapping from field-name to the corresponding key (as used in fields()).
249 * Array(string $name => string $uniqueName).
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()));
255 return Civi
::$statics[__CLASS__
]['fieldKeys'];
259 * Returns the names of this table
263 public static function getTableName() {
264 return self
::$_tableName;
268 * Returns if this table needs to be logged
272 public function getLog() {
277 * Returns the list of fields that can be imported
279 * @param bool $prefix
283 public static function &import($prefix = FALSE) {
284 $r = CRM_Core_DAO_AllCoreTables
::getImports(__CLASS__
, 'translation', $prefix, []);
289 * Returns the list of fields that can be exported
291 * @param bool $prefix
295 public static function &export($prefix = FALSE) {
296 $r = CRM_Core_DAO_AllCoreTables
::getExports(__CLASS__
, 'translation', $prefix, []);
301 * Returns the list of indices
303 * @param bool $localize
307 public static function indices($localize = TRUE) {
309 'index_entity_lang' => [
310 'name' => 'index_entity_lang',
316 'localizable' => FALSE,
317 'sig' => 'civicrm_translation::0::entity_id::entity_table::language',
320 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables
::multilingualize(__CLASS__
, $indices) : $indices;