Fix any title or label that contain name of own entity
[civicrm-core.git] / CRM / Core / DAO / Worldregion.php
CommitLineData
e501603b 1<?php
c3fc2621 2
e501603b
TO
3/**
4 * @package CRM
ca5cec67 5 * @copyright CiviCRM LLC https://civicrm.org/licensing
e501603b
TO
6 *
7 * Generated from xml/schema/CRM/Core/Worldregion.xml
8 * DO NOT EDIT. Generated by CRM_Core_CodeGen
8ab43c93 9 * (GenCodeChecksum:2f91a9ed30715b6c08bd8913d6a8fe88)
e501603b 10 */
c3fc2621 11
f41f0342 12/**
c3fc2621 13 * Database access object for the Worldregion entity.
f41f0342 14 */
e501603b 15class CRM_Core_DAO_Worldregion extends CRM_Core_DAO {
929a1c14
CW
16 const EXT = 'civicrm';
17 const TABLE_ADDED = '1.8';
c3fc2621 18
e501603b 19 /**
f41f0342 20 * Static instance to hold the table name.
e501603b
TO
21 *
22 * @var string
23 */
fa45b5b9 24 public static $_tableName = 'civicrm_worldregion';
c3fc2621 25
e501603b 26 /**
f41f0342 27 * Should CiviCRM log any modifications to this table in the civicrm_log table.
e501603b 28 *
c3fc2621 29 * @var bool
e501603b 30 */
fa45b5b9 31 public static $_log = FALSE;
c3fc2621 32
e501603b
TO
33 /**
34 * Country Id
35 *
e6ca0a57 36 * @var int
e501603b
TO
37 */
38 public $id;
c3fc2621 39
e501603b
TO
40 /**
41 * Region name to be associated with countries
42 *
43 * @var string
44 */
45 public $name;
c3fc2621 46
e501603b 47 /**
f41f0342 48 * Class constructor.
e501603b 49 */
c3fc2621 50 public function __construct() {
e501603b
TO
51 $this->__table = 'civicrm_worldregion';
52 parent::__construct();
53 }
c3fc2621 54
449c4e6b
CW
55 /**
56 * Returns localized title of this entity.
7b66c3b5
AH
57 *
58 * @param bool $plural
59 * Whether to return the plural version of the title.
449c4e6b 60 */
7b66c3b5
AH
61 public static function getEntityTitle($plural = FALSE) {
62 return $plural ? ts('Worldregions') : ts('Worldregion');
449c4e6b
CW
63 }
64
e501603b
TO
65 /**
66 * Returns all the column names of this table
67 *
68 * @return array
69 */
c3fc2621 70 public static function &fields() {
346aaaba 71 if (!isset(Civi::$statics[__CLASS__]['fields'])) {
c3fc2621
CW
72 Civi::$statics[__CLASS__]['fields'] = [
73 'id' => [
e501603b
TO
74 'name' => 'id',
75 'type' => CRM_Utils_Type::T_INT,
c3fc2621 76 'title' => ts('World Region ID'),
215b423e 77 'description' => ts('Country Id'),
c3fc2621 78 'required' => TRUE,
a36434b9 79 'where' => 'civicrm_worldregion.id',
522a26c9 80 'table_name' => 'civicrm_worldregion',
81 'entity' => 'Worldregion',
82 'bao' => 'CRM_Core_DAO_Worldregion',
6a7e5e5d 83 'localizable' => 0,
a9d0587b 84 'add' => '1.8',
c3fc2621
CW
85 ],
86 'world_region' => [
e501603b
TO
87 'name' => 'name',
88 'type' => CRM_Utils_Type::T_STRING,
c3fc2621 89 'title' => ts('World Region'),
215b423e 90 'description' => ts('Region name to be associated with countries'),
e501603b
TO
91 'maxlength' => 128,
92 'size' => CRM_Utils_Type::HUGE,
e501603b 93 'where' => 'civicrm_worldregion.name',
a36434b9 94 'export' => TRUE,
522a26c9 95 'table_name' => 'civicrm_worldregion',
96 'entity' => 'Worldregion',
97 'bao' => 'CRM_Core_DAO_Worldregion',
6a7e5e5d 98 'localizable' => 0,
a9d0587b 99 'add' => '1.8',
c3fc2621
CW
100 ],
101 ];
346aaaba 102 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']);
e501603b 103 }
346aaaba 104 return Civi::$statics[__CLASS__]['fields'];
e501603b 105 }
c3fc2621 106
e501603b 107 /**
bd8e0b14 108 * Return a mapping from field-name to the corresponding key (as used in fields()).
e501603b
TO
109 *
110 * @return array
bd8e0b14 111 * Array(string $name => string $uniqueName).
e501603b 112 */
c3fc2621 113 public static function &fieldKeys() {
bd8e0b14
TO
114 if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) {
115 Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields()));
e501603b 116 }
bd8e0b14 117 return Civi::$statics[__CLASS__]['fieldKeys'];
e501603b 118 }
c3fc2621 119
e501603b
TO
120 /**
121 * Returns the names of this table
122 *
123 * @return string
124 */
c3fc2621 125 public static function getTableName() {
e501603b
TO
126 return self::$_tableName;
127 }
c3fc2621 128
e501603b
TO
129 /**
130 * Returns if this table needs to be logged
131 *
c3fc2621 132 * @return bool
e501603b 133 */
c3fc2621 134 public function getLog() {
e501603b
TO
135 return self::$_log;
136 }
c3fc2621 137
e501603b
TO
138 /**
139 * Returns the list of fields that can be imported
140 *
141 * @param bool $prefix
142 *
143 * @return array
144 */
c3fc2621
CW
145 public static function &import($prefix = FALSE) {
146 $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'worldregion', $prefix, []);
60808919 147 return $r;
e501603b 148 }
c3fc2621 149
e501603b
TO
150 /**
151 * Returns the list of fields that can be exported
152 *
153 * @param bool $prefix
154 *
155 * @return array
156 */
c3fc2621
CW
157 public static function &export($prefix = FALSE) {
158 $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'worldregion', $prefix, []);
60808919 159 return $r;
e501603b 160 }
c3fc2621 161
e7a6b91a
AS
162 /**
163 * Returns the list of indices
c3fc2621
CW
164 *
165 * @param bool $localize
166 *
167 * @return array
e7a6b91a
AS
168 */
169 public static function indices($localize = TRUE) {
c3fc2621 170 $indices = [];
e7a6b91a
AS
171 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices;
172 }
c3fc2621 173
e501603b 174}