Merge pull request #23825 from colemanw/profileExport
[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
28979d65 9 * (GenCodeChecksum:e8b2ad34381b7a644a5ea7e70cebf27e)
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 33 /**
2cbbebe8 34 * Country ID
e501603b 35 *
28979d65
CW
36 * @var int|string|null
37 * (SQL type: int unsigned)
38 * Note that values will be retrieved from the database as a string.
e501603b
TO
39 */
40 public $id;
c3fc2621 41
e501603b
TO
42 /**
43 * Region name to be associated with countries
44 *
28979d65
CW
45 * @var string|null
46 * (SQL type: varchar(128))
47 * Note that values will be retrieved from the database as a string.
e501603b
TO
48 */
49 public $name;
c3fc2621 50
e501603b 51 /**
f41f0342 52 * Class constructor.
e501603b 53 */
c3fc2621 54 public function __construct() {
e501603b
TO
55 $this->__table = 'civicrm_worldregion';
56 parent::__construct();
57 }
c3fc2621 58
449c4e6b
CW
59 /**
60 * Returns localized title of this entity.
7b66c3b5
AH
61 *
62 * @param bool $plural
63 * Whether to return the plural version of the title.
449c4e6b 64 */
7b66c3b5
AH
65 public static function getEntityTitle($plural = FALSE) {
66 return $plural ? ts('Worldregions') : ts('Worldregion');
449c4e6b
CW
67 }
68
e501603b
TO
69 /**
70 * Returns all the column names of this table
71 *
72 * @return array
73 */
c3fc2621 74 public static function &fields() {
346aaaba 75 if (!isset(Civi::$statics[__CLASS__]['fields'])) {
c3fc2621
CW
76 Civi::$statics[__CLASS__]['fields'] = [
77 'id' => [
e501603b
TO
78 'name' => 'id',
79 'type' => CRM_Utils_Type::T_INT,
c3fc2621 80 'title' => ts('World Region ID'),
2cbbebe8 81 'description' => ts('Country ID'),
c3fc2621 82 'required' => TRUE,
a36434b9 83 'where' => 'civicrm_worldregion.id',
522a26c9 84 'table_name' => 'civicrm_worldregion',
85 'entity' => 'Worldregion',
86 'bao' => 'CRM_Core_DAO_Worldregion',
6a7e5e5d 87 'localizable' => 0,
2cbbebe8
A
88 'html' => [
89 'type' => 'Number',
90 ],
1fe423d6 91 'readonly' => TRUE,
a9d0587b 92 'add' => '1.8',
c3fc2621
CW
93 ],
94 'world_region' => [
e501603b
TO
95 'name' => 'name',
96 'type' => CRM_Utils_Type::T_STRING,
c3fc2621 97 'title' => ts('World Region'),
215b423e 98 'description' => ts('Region name to be associated with countries'),
e501603b
TO
99 'maxlength' => 128,
100 'size' => CRM_Utils_Type::HUGE,
e501603b 101 'where' => 'civicrm_worldregion.name',
a36434b9 102 'export' => TRUE,
522a26c9 103 'table_name' => 'civicrm_worldregion',
104 'entity' => 'Worldregion',
105 'bao' => 'CRM_Core_DAO_Worldregion',
6a7e5e5d 106 'localizable' => 0,
a9d0587b 107 'add' => '1.8',
c3fc2621
CW
108 ],
109 ];
346aaaba 110 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']);
e501603b 111 }
346aaaba 112 return Civi::$statics[__CLASS__]['fields'];
e501603b 113 }
c3fc2621 114
e501603b 115 /**
bd8e0b14 116 * Return a mapping from field-name to the corresponding key (as used in fields()).
e501603b
TO
117 *
118 * @return array
bd8e0b14 119 * Array(string $name => string $uniqueName).
e501603b 120 */
c3fc2621 121 public static function &fieldKeys() {
bd8e0b14
TO
122 if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) {
123 Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields()));
e501603b 124 }
bd8e0b14 125 return Civi::$statics[__CLASS__]['fieldKeys'];
e501603b 126 }
c3fc2621 127
e501603b
TO
128 /**
129 * Returns the names of this table
130 *
131 * @return string
132 */
c3fc2621 133 public static function getTableName() {
e501603b
TO
134 return self::$_tableName;
135 }
c3fc2621 136
e501603b
TO
137 /**
138 * Returns if this table needs to be logged
139 *
c3fc2621 140 * @return bool
e501603b 141 */
c3fc2621 142 public function getLog() {
e501603b
TO
143 return self::$_log;
144 }
c3fc2621 145
e501603b
TO
146 /**
147 * Returns the list of fields that can be imported
148 *
149 * @param bool $prefix
150 *
151 * @return array
152 */
c3fc2621
CW
153 public static function &import($prefix = FALSE) {
154 $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'worldregion', $prefix, []);
60808919 155 return $r;
e501603b 156 }
c3fc2621 157
e501603b
TO
158 /**
159 * Returns the list of fields that can be exported
160 *
161 * @param bool $prefix
162 *
163 * @return array
164 */
c3fc2621
CW
165 public static function &export($prefix = FALSE) {
166 $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'worldregion', $prefix, []);
60808919 167 return $r;
e501603b 168 }
c3fc2621 169
e7a6b91a
AS
170 /**
171 * Returns the list of indices
c3fc2621
CW
172 *
173 * @param bool $localize
174 *
175 * @return array
e7a6b91a
AS
176 */
177 public static function indices($localize = TRUE) {
c3fc2621 178 $indices = [];
e7a6b91a
AS
179 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices;
180 }
c3fc2621 181
e501603b 182}