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