Merge pull request #17345 from eileenmcnaughton/ev_batch
[civicrm-core.git] / CRM / Core / DAO / County.php
1 <?php
2
3 /**
4 * @package CRM
5 * @copyright CiviCRM LLC https://civicrm.org/licensing
6 *
7 * Generated from xml/schema/CRM/Core/County.xml
8 * DO NOT EDIT. Generated by CRM_Core_CodeGen
9 * (GenCodeChecksum:c22121afe6539d3ec7c51e905de299d7)
10 */
11
12 /**
13 * Database access object for the County entity.
14 */
15 class CRM_Core_DAO_County extends CRM_Core_DAO {
16
17 /**
18 * Static instance to hold the table name.
19 *
20 * @var string
21 */
22 public static $_tableName = 'civicrm_county';
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 * County ID
33 *
34 * @var int
35 */
36 public $id;
37
38 /**
39 * Name of County
40 *
41 * @var string
42 */
43 public $name;
44
45 /**
46 * 2-4 Character Abbreviation of County
47 *
48 * @var string
49 */
50 public $abbreviation;
51
52 /**
53 * ID of State/Province that County belongs
54 *
55 * @var int
56 */
57 public $state_province_id;
58
59 /**
60 * Class constructor.
61 */
62 public function __construct() {
63 $this->__table = 'civicrm_county';
64 parent::__construct();
65 }
66
67 /**
68 * Returns foreign keys and entity references.
69 *
70 * @return array
71 * [CRM_Core_Reference_Interface]
72 */
73 public static function getReferenceColumns() {
74 if (!isset(Civi::$statics[__CLASS__]['links'])) {
75 Civi::$statics[__CLASS__]['links'] = static::createReferenceColumns(__CLASS__);
76 Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'state_province_id', 'civicrm_state_province', 'id');
77 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'links_callback', Civi::$statics[__CLASS__]['links']);
78 }
79 return Civi::$statics[__CLASS__]['links'];
80 }
81
82 /**
83 * Returns all the column names of this table
84 *
85 * @return array
86 */
87 public static function &fields() {
88 if (!isset(Civi::$statics[__CLASS__]['fields'])) {
89 Civi::$statics[__CLASS__]['fields'] = [
90 'id' => [
91 'name' => 'id',
92 'type' => CRM_Utils_Type::T_INT,
93 'title' => ts('County ID'),
94 'description' => ts('County ID'),
95 'required' => TRUE,
96 'where' => 'civicrm_county.id',
97 'table_name' => 'civicrm_county',
98 'entity' => 'County',
99 'bao' => 'CRM_Core_DAO_County',
100 'localizable' => 0,
101 ],
102 'name' => [
103 'name' => 'name',
104 'type' => CRM_Utils_Type::T_STRING,
105 'title' => ts('County'),
106 'description' => ts('Name of County'),
107 'maxlength' => 64,
108 'size' => CRM_Utils_Type::BIG,
109 'import' => TRUE,
110 'where' => 'civicrm_county.name',
111 'headerPattern' => '/county/i',
112 'dataPattern' => '/[A-Z]{2}/',
113 'export' => TRUE,
114 'table_name' => 'civicrm_county',
115 'entity' => 'County',
116 'bao' => 'CRM_Core_DAO_County',
117 'localizable' => 0,
118 ],
119 'abbreviation' => [
120 'name' => 'abbreviation',
121 'type' => CRM_Utils_Type::T_STRING,
122 'title' => ts('County Abbreviation'),
123 'description' => ts('2-4 Character Abbreviation of County'),
124 'maxlength' => 4,
125 'size' => CRM_Utils_Type::FOUR,
126 'where' => 'civicrm_county.abbreviation',
127 'table_name' => 'civicrm_county',
128 'entity' => 'County',
129 'bao' => 'CRM_Core_DAO_County',
130 'localizable' => 0,
131 ],
132 'state_province_id' => [
133 'name' => 'state_province_id',
134 'type' => CRM_Utils_Type::T_INT,
135 'title' => ts('State'),
136 'description' => ts('ID of State/Province that County belongs'),
137 'required' => TRUE,
138 'where' => 'civicrm_county.state_province_id',
139 'table_name' => 'civicrm_county',
140 'entity' => 'County',
141 'bao' => 'CRM_Core_DAO_County',
142 'localizable' => 0,
143 'FKClassName' => 'CRM_Core_DAO_StateProvince',
144 'pseudoconstant' => [
145 'table' => 'civicrm_state_province',
146 'keyColumn' => 'id',
147 'labelColumn' => 'name',
148 ],
149 ],
150 ];
151 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']);
152 }
153 return Civi::$statics[__CLASS__]['fields'];
154 }
155
156 /**
157 * Return a mapping from field-name to the corresponding key (as used in fields()).
158 *
159 * @return array
160 * Array(string $name => string $uniqueName).
161 */
162 public static function &fieldKeys() {
163 if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) {
164 Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields()));
165 }
166 return Civi::$statics[__CLASS__]['fieldKeys'];
167 }
168
169 /**
170 * Returns the names of this table
171 *
172 * @return string
173 */
174 public static function getTableName() {
175 return self::$_tableName;
176 }
177
178 /**
179 * Returns if this table needs to be logged
180 *
181 * @return bool
182 */
183 public function getLog() {
184 return self::$_log;
185 }
186
187 /**
188 * Returns the list of fields that can be imported
189 *
190 * @param bool $prefix
191 *
192 * @return array
193 */
194 public static function &import($prefix = FALSE) {
195 $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'county', $prefix, []);
196 return $r;
197 }
198
199 /**
200 * Returns the list of fields that can be exported
201 *
202 * @param bool $prefix
203 *
204 * @return array
205 */
206 public static function &export($prefix = FALSE) {
207 $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'county', $prefix, []);
208 return $r;
209 }
210
211 /**
212 * Returns the list of indices
213 *
214 * @param bool $localize
215 *
216 * @return array
217 */
218 public static function indices($localize = TRUE) {
219 $indices = [
220 'UI_name_state_id' => [
221 'name' => 'UI_name_state_id',
222 'field' => [
223 0 => 'name',
224 1 => 'state_province_id',
225 ],
226 'localizable' => FALSE,
227 'unique' => TRUE,
228 'sig' => 'civicrm_county::1::name::state_province_id',
229 ],
230 ];
231 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices;
232 }
233
234 }