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