Merge pull request #2 from civicrm/master
[civicrm-core.git] / CRM / Core / DAO / Worldregion.php
CommitLineData
e501603b 1<?php
c3fc2621 2
e501603b
TO
3/**
4 * @package CRM
6b83d5bd 5 * @copyright CiviCRM LLC (c) 2004-2019
e501603b
TO
6 *
7 * Generated from xml/schema/CRM/Core/Worldregion.xml
8 * DO NOT EDIT. Generated by CRM_Core_CodeGen
e6ca0a57 9 * (GenCodeChecksum:b607c0ba0b25b3f785779384fc6a6887)
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 {
c3fc2621 16
e501603b 17 /**
f41f0342 18 * Static instance to hold the table name.
e501603b
TO
19 *
20 * @var string
21 */
fa45b5b9 22 public static $_tableName = 'civicrm_worldregion';
c3fc2621 23
e501603b 24 /**
f41f0342 25 * Should CiviCRM log any modifications to this table in the civicrm_log table.
e501603b 26 *
c3fc2621 27 * @var bool
e501603b 28 */
fa45b5b9 29 public static $_log = FALSE;
c3fc2621 30
e501603b
TO
31 /**
32 * Country Id
33 *
e6ca0a57 34 * @var int
e501603b
TO
35 */
36 public $id;
c3fc2621 37
e501603b
TO
38 /**
39 * Region name to be associated with countries
40 *
41 * @var string
42 */
43 public $name;
c3fc2621 44
e501603b 45 /**
f41f0342 46 * Class constructor.
e501603b 47 */
c3fc2621 48 public function __construct() {
e501603b
TO
49 $this->__table = 'civicrm_worldregion';
50 parent::__construct();
51 }
c3fc2621 52
e501603b
TO
53 /**
54 * Returns all the column names of this table
55 *
56 * @return array
57 */
c3fc2621 58 public static function &fields() {
346aaaba 59 if (!isset(Civi::$statics[__CLASS__]['fields'])) {
c3fc2621
CW
60 Civi::$statics[__CLASS__]['fields'] = [
61 'id' => [
e501603b
TO
62 'name' => 'id',
63 'type' => CRM_Utils_Type::T_INT,
c3fc2621 64 'title' => ts('World Region ID'),
215b423e 65 'description' => ts('Country Id'),
c3fc2621 66 'required' => TRUE,
a36434b9 67 'where' => 'civicrm_worldregion.id',
522a26c9 68 'table_name' => 'civicrm_worldregion',
69 'entity' => 'Worldregion',
70 'bao' => 'CRM_Core_DAO_Worldregion',
6a7e5e5d 71 'localizable' => 0,
c3fc2621
CW
72 ],
73 'world_region' => [
e501603b
TO
74 'name' => 'name',
75 'type' => CRM_Utils_Type::T_STRING,
c3fc2621 76 'title' => ts('World Region'),
215b423e 77 'description' => ts('Region name to be associated with countries'),
e501603b
TO
78 'maxlength' => 128,
79 'size' => CRM_Utils_Type::HUGE,
e501603b 80 'where' => 'civicrm_worldregion.name',
a36434b9 81 'export' => TRUE,
522a26c9 82 'table_name' => 'civicrm_worldregion',
83 'entity' => 'Worldregion',
84 'bao' => 'CRM_Core_DAO_Worldregion',
6a7e5e5d 85 'localizable' => 0,
c3fc2621
CW
86 ],
87 ];
346aaaba 88 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']);
e501603b 89 }
346aaaba 90 return Civi::$statics[__CLASS__]['fields'];
e501603b 91 }
c3fc2621 92
e501603b 93 /**
bd8e0b14 94 * Return a mapping from field-name to the corresponding key (as used in fields()).
e501603b
TO
95 *
96 * @return array
bd8e0b14 97 * Array(string $name => string $uniqueName).
e501603b 98 */
c3fc2621 99 public static function &fieldKeys() {
bd8e0b14
TO
100 if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) {
101 Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields()));
e501603b 102 }
bd8e0b14 103 return Civi::$statics[__CLASS__]['fieldKeys'];
e501603b 104 }
c3fc2621 105
e501603b
TO
106 /**
107 * Returns the names of this table
108 *
109 * @return string
110 */
c3fc2621 111 public static function getTableName() {
e501603b
TO
112 return self::$_tableName;
113 }
c3fc2621 114
e501603b
TO
115 /**
116 * Returns if this table needs to be logged
117 *
c3fc2621 118 * @return bool
e501603b 119 */
c3fc2621 120 public function getLog() {
e501603b
TO
121 return self::$_log;
122 }
c3fc2621 123
e501603b
TO
124 /**
125 * Returns the list of fields that can be imported
126 *
127 * @param bool $prefix
128 *
129 * @return array
130 */
c3fc2621
CW
131 public static function &import($prefix = FALSE) {
132 $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'worldregion', $prefix, []);
60808919 133 return $r;
e501603b 134 }
c3fc2621 135
e501603b
TO
136 /**
137 * Returns the list of fields that can be exported
138 *
139 * @param bool $prefix
140 *
141 * @return array
142 */
c3fc2621
CW
143 public static function &export($prefix = FALSE) {
144 $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'worldregion', $prefix, []);
60808919 145 return $r;
e501603b 146 }
c3fc2621 147
e7a6b91a
AS
148 /**
149 * Returns the list of indices
c3fc2621
CW
150 *
151 * @param bool $localize
152 *
153 * @return array
e7a6b91a
AS
154 */
155 public static function indices($localize = TRUE) {
c3fc2621 156 $indices = [];
e7a6b91a
AS
157 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices;
158 }
c3fc2621 159
e501603b 160}