Merge pull request #22524 from braders/contacttype-types
[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:897ca1a3833baf2e0c5bc09b350d26cd)
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 'html' => [
85 'type' => 'Number',
86 ],
87 'readonly' => TRUE,
88 'add' => '1.8',
89 ],
90 'world_region' => [
91 'name' => 'name',
92 'type' => CRM_Utils_Type::T_STRING,
93 'title' => ts('World Region'),
94 'description' => ts('Region name to be associated with countries'),
95 'maxlength' => 128,
96 'size' => CRM_Utils_Type::HUGE,
97 'where' => 'civicrm_worldregion.name',
98 'export' => TRUE,
99 'table_name' => 'civicrm_worldregion',
100 'entity' => 'Worldregion',
101 'bao' => 'CRM_Core_DAO_Worldregion',
102 'localizable' => 0,
103 'add' => '1.8',
104 ],
105 ];
106 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']);
107 }
108 return Civi::$statics[__CLASS__]['fields'];
109 }
110
111 /**
112 * Return a mapping from field-name to the corresponding key (as used in fields()).
113 *
114 * @return array
115 * Array(string $name => string $uniqueName).
116 */
117 public static function &fieldKeys() {
118 if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) {
119 Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields()));
120 }
121 return Civi::$statics[__CLASS__]['fieldKeys'];
122 }
123
124 /**
125 * Returns the names of this table
126 *
127 * @return string
128 */
129 public static function getTableName() {
130 return self::$_tableName;
131 }
132
133 /**
134 * Returns if this table needs to be logged
135 *
136 * @return bool
137 */
138 public function getLog() {
139 return self::$_log;
140 }
141
142 /**
143 * Returns the list of fields that can be imported
144 *
145 * @param bool $prefix
146 *
147 * @return array
148 */
149 public static function &import($prefix = FALSE) {
150 $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'worldregion', $prefix, []);
151 return $r;
152 }
153
154 /**
155 * Returns the list of fields that can be exported
156 *
157 * @param bool $prefix
158 *
159 * @return array
160 */
161 public static function &export($prefix = FALSE) {
162 $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'worldregion', $prefix, []);
163 return $r;
164 }
165
166 /**
167 * Returns the list of indices
168 *
169 * @param bool $localize
170 *
171 * @return array
172 */
173 public static function indices($localize = TRUE) {
174 $indices = [];
175 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices;
176 }
177
178 }