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