Merge pull request #14266 from seamuslee001/dev_core_369
[civicrm-core.git] / CRM / Core / DAO / Worldregion.php
1 <?php
2
3 /**
4 * @package CRM
5 * @copyright CiviCRM LLC (c) 2004-2019
6 *
7 * Generated from xml/schema/CRM/Core/Worldregion.xml
8 * DO NOT EDIT. Generated by CRM_Core_CodeGen
9 * (GenCodeChecksum:f326bc6047454a630b352baf190b0cac)
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 unsigned
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 all the column names of this table
55 *
56 * @return array
57 */
58 public static function &fields() {
59 if (!isset(Civi::$statics[__CLASS__]['fields'])) {
60 Civi::$statics[__CLASS__]['fields'] = [
61 'id' => [
62 'name' => 'id',
63 'type' => CRM_Utils_Type::T_INT,
64 'title' => ts('World Region ID'),
65 'description' => ts('Country Id'),
66 'required' => TRUE,
67 'where' => 'civicrm_worldregion.id',
68 'table_name' => 'civicrm_worldregion',
69 'entity' => 'Worldregion',
70 'bao' => 'CRM_Core_DAO_Worldregion',
71 'localizable' => 0,
72 ],
73 'world_region' => [
74 'name' => 'name',
75 'type' => CRM_Utils_Type::T_STRING,
76 'title' => ts('World Region'),
77 'description' => ts('Region name to be associated with countries'),
78 'maxlength' => 128,
79 'size' => CRM_Utils_Type::HUGE,
80 'where' => 'civicrm_worldregion.name',
81 'export' => TRUE,
82 'table_name' => 'civicrm_worldregion',
83 'entity' => 'Worldregion',
84 'bao' => 'CRM_Core_DAO_Worldregion',
85 'localizable' => 0,
86 ],
87 ];
88 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']);
89 }
90 return Civi::$statics[__CLASS__]['fields'];
91 }
92
93 /**
94 * Return a mapping from field-name to the corresponding key (as used in fields()).
95 *
96 * @return array
97 * Array(string $name => string $uniqueName).
98 */
99 public static function &fieldKeys() {
100 if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) {
101 Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields()));
102 }
103 return Civi::$statics[__CLASS__]['fieldKeys'];
104 }
105
106 /**
107 * Returns the names of this table
108 *
109 * @return string
110 */
111 public static function getTableName() {
112 return self::$_tableName;
113 }
114
115 /**
116 * Returns if this table needs to be logged
117 *
118 * @return bool
119 */
120 public function getLog() {
121 return self::$_log;
122 }
123
124 /**
125 * Returns the list of fields that can be imported
126 *
127 * @param bool $prefix
128 *
129 * @return array
130 */
131 public static function &import($prefix = FALSE) {
132 $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'worldregion', $prefix, []);
133 return $r;
134 }
135
136 /**
137 * Returns the list of fields that can be exported
138 *
139 * @param bool $prefix
140 *
141 * @return array
142 */
143 public static function &export($prefix = FALSE) {
144 $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'worldregion', $prefix, []);
145 return $r;
146 }
147
148 /**
149 * Returns the list of indices
150 *
151 * @param bool $localize
152 *
153 * @return array
154 */
155 public static function indices($localize = TRUE) {
156 $indices = [];
157 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices;
158 }
159
160 }