Merge pull request #18148 from civicrm/5.29
[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
929a1c14 9 * (GenCodeChecksum:0312ba4169a285839ec54d655ff5ceb3)
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.
57 */
58 public static function getEntityTitle() {
59 return ts('Worldregions');
60 }
61
e501603b
TO
62 /**
63 * Returns all the column names of this table
64 *
65 * @return array
66 */
c3fc2621 67 public static function &fields() {
346aaaba 68 if (!isset(Civi::$statics[__CLASS__]['fields'])) {
c3fc2621
CW
69 Civi::$statics[__CLASS__]['fields'] = [
70 'id' => [
e501603b
TO
71 'name' => 'id',
72 'type' => CRM_Utils_Type::T_INT,
c3fc2621 73 'title' => ts('World Region ID'),
215b423e 74 'description' => ts('Country Id'),
c3fc2621 75 'required' => TRUE,
a36434b9 76 'where' => 'civicrm_worldregion.id',
522a26c9 77 'table_name' => 'civicrm_worldregion',
78 'entity' => 'Worldregion',
79 'bao' => 'CRM_Core_DAO_Worldregion',
6a7e5e5d 80 'localizable' => 0,
a9d0587b 81 'add' => '1.8',
c3fc2621
CW
82 ],
83 'world_region' => [
e501603b
TO
84 'name' => 'name',
85 'type' => CRM_Utils_Type::T_STRING,
c3fc2621 86 'title' => ts('World Region'),
215b423e 87 'description' => ts('Region name to be associated with countries'),
e501603b
TO
88 'maxlength' => 128,
89 'size' => CRM_Utils_Type::HUGE,
e501603b 90 'where' => 'civicrm_worldregion.name',
a36434b9 91 'export' => TRUE,
522a26c9 92 'table_name' => 'civicrm_worldregion',
93 'entity' => 'Worldregion',
94 'bao' => 'CRM_Core_DAO_Worldregion',
6a7e5e5d 95 'localizable' => 0,
a9d0587b 96 'add' => '1.8',
c3fc2621
CW
97 ],
98 ];
346aaaba 99 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']);
e501603b 100 }
346aaaba 101 return Civi::$statics[__CLASS__]['fields'];
e501603b 102 }
c3fc2621 103
e501603b 104 /**
bd8e0b14 105 * Return a mapping from field-name to the corresponding key (as used in fields()).
e501603b
TO
106 *
107 * @return array
bd8e0b14 108 * Array(string $name => string $uniqueName).
e501603b 109 */
c3fc2621 110 public static function &fieldKeys() {
bd8e0b14
TO
111 if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) {
112 Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields()));
e501603b 113 }
bd8e0b14 114 return Civi::$statics[__CLASS__]['fieldKeys'];
e501603b 115 }
c3fc2621 116
e501603b
TO
117 /**
118 * Returns the names of this table
119 *
120 * @return string
121 */
c3fc2621 122 public static function getTableName() {
e501603b
TO
123 return self::$_tableName;
124 }
c3fc2621 125
e501603b
TO
126 /**
127 * Returns if this table needs to be logged
128 *
c3fc2621 129 * @return bool
e501603b 130 */
c3fc2621 131 public function getLog() {
e501603b
TO
132 return self::$_log;
133 }
c3fc2621 134
e501603b
TO
135 /**
136 * Returns the list of fields that can be imported
137 *
138 * @param bool $prefix
139 *
140 * @return array
141 */
c3fc2621
CW
142 public static function &import($prefix = FALSE) {
143 $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'worldregion', $prefix, []);
60808919 144 return $r;
e501603b 145 }
c3fc2621 146
e501603b
TO
147 /**
148 * Returns the list of fields that can be exported
149 *
150 * @param bool $prefix
151 *
152 * @return array
153 */
c3fc2621
CW
154 public static function &export($prefix = FALSE) {
155 $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'worldregion', $prefix, []);
60808919 156 return $r;
e501603b 157 }
c3fc2621 158
e7a6b91a
AS
159 /**
160 * Returns the list of indices
c3fc2621
CW
161 *
162 * @param bool $localize
163 *
164 * @return array
e7a6b91a
AS
165 */
166 public static function indices($localize = TRUE) {
c3fc2621 167 $indices = [];
e7a6b91a
AS
168 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices;
169 }
c3fc2621 170
e501603b 171}