Commit | Line | Data |
---|---|---|
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/County.xml | |
8 | * DO NOT EDIT. Generated by CRM_Core_CodeGen | |
28979d65 | 9 | * (GenCodeChecksum:5a261e24e77bb54854f782628a13dbf6) |
e501603b | 10 | */ |
c3fc2621 | 11 | |
f41f0342 | 12 | /** |
c3fc2621 | 13 | * Database access object for the County entity. |
f41f0342 | 14 | */ |
e501603b | 15 | class CRM_Core_DAO_County extends CRM_Core_DAO { |
929a1c14 CW |
16 | const EXT = 'civicrm'; |
17 | const TABLE_ADDED = '1.1'; | |
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_county'; |
c3fc2621 | 25 | |
8ab43c93 CW |
26 | /** |
27 | * Field to show when displaying a record. | |
28 | * | |
29 | * @var string | |
30 | */ | |
31 | public static $_labelField = 'name'; | |
32 | ||
e501603b | 33 | /** |
f41f0342 | 34 | * Should CiviCRM log any modifications to this table in the civicrm_log table. |
e501603b | 35 | * |
c3fc2621 | 36 | * @var bool |
e501603b | 37 | */ |
fa45b5b9 | 38 | public static $_log = FALSE; |
c3fc2621 | 39 | |
e501603b TO |
40 | /** |
41 | * County ID | |
42 | * | |
28979d65 CW |
43 | * @var int|string|null |
44 | * (SQL type: int unsigned) | |
45 | * Note that values will be retrieved from the database as a string. | |
e501603b TO |
46 | */ |
47 | public $id; | |
c3fc2621 | 48 | |
e501603b TO |
49 | /** |
50 | * Name of County | |
51 | * | |
28979d65 CW |
52 | * @var string|null |
53 | * (SQL type: varchar(64)) | |
54 | * Note that values will be retrieved from the database as a string. | |
e501603b TO |
55 | */ |
56 | public $name; | |
c3fc2621 | 57 | |
e501603b TO |
58 | /** |
59 | * 2-4 Character Abbreviation of County | |
60 | * | |
28979d65 CW |
61 | * @var string|null |
62 | * (SQL type: varchar(4)) | |
63 | * Note that values will be retrieved from the database as a string. | |
e501603b TO |
64 | */ |
65 | public $abbreviation; | |
c3fc2621 | 66 | |
e501603b TO |
67 | /** |
68 | * ID of State/Province that County belongs | |
69 | * | |
28979d65 CW |
70 | * @var int|string |
71 | * (SQL type: int unsigned) | |
72 | * Note that values will be retrieved from the database as a string. | |
e501603b TO |
73 | */ |
74 | public $state_province_id; | |
c3fc2621 | 75 | |
005f02ec MW |
76 | /** |
77 | * Is this County active? | |
78 | * | |
28979d65 CW |
79 | * @var bool|string|null |
80 | * (SQL type: tinyint) | |
81 | * Note that values will be retrieved from the database as a string. | |
005f02ec MW |
82 | */ |
83 | public $is_active; | |
84 | ||
e501603b | 85 | /** |
f41f0342 | 86 | * Class constructor. |
e501603b | 87 | */ |
c3fc2621 | 88 | public function __construct() { |
e501603b TO |
89 | $this->__table = 'civicrm_county'; |
90 | parent::__construct(); | |
91 | } | |
c3fc2621 | 92 | |
449c4e6b CW |
93 | /** |
94 | * Returns localized title of this entity. | |
7b66c3b5 AH |
95 | * |
96 | * @param bool $plural | |
97 | * Whether to return the plural version of the title. | |
449c4e6b | 98 | */ |
7b66c3b5 AH |
99 | public static function getEntityTitle($plural = FALSE) { |
100 | return $plural ? ts('Counties') : ts('County'); | |
449c4e6b CW |
101 | } |
102 | ||
e501603b | 103 | /** |
f41f0342 | 104 | * Returns foreign keys and entity references. |
e501603b TO |
105 | * |
106 | * @return array | |
107 | * [CRM_Core_Reference_Interface] | |
108 | */ | |
c3fc2621 | 109 | public static function getReferenceColumns() { |
346aaaba | 110 | if (!isset(Civi::$statics[__CLASS__]['links'])) { |
fa45b5b9 | 111 | Civi::$statics[__CLASS__]['links'] = static::createReferenceColumns(__CLASS__); |
c3fc2621 | 112 | Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'state_province_id', 'civicrm_state_province', 'id'); |
346aaaba | 113 | CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'links_callback', Civi::$statics[__CLASS__]['links']); |
e501603b | 114 | } |
346aaaba | 115 | return Civi::$statics[__CLASS__]['links']; |
e501603b | 116 | } |
c3fc2621 | 117 | |
e501603b TO |
118 | /** |
119 | * Returns all the column names of this table | |
120 | * | |
121 | * @return array | |
122 | */ | |
c3fc2621 | 123 | public static function &fields() { |
346aaaba | 124 | if (!isset(Civi::$statics[__CLASS__]['fields'])) { |
c3fc2621 CW |
125 | Civi::$statics[__CLASS__]['fields'] = [ |
126 | 'id' => [ | |
e501603b TO |
127 | 'name' => 'id', |
128 | 'type' => CRM_Utils_Type::T_INT, | |
c3fc2621 | 129 | 'title' => ts('County ID'), |
215b423e | 130 | 'description' => ts('County ID'), |
c3fc2621 | 131 | 'required' => TRUE, |
a36434b9 | 132 | 'where' => 'civicrm_county.id', |
522a26c9 | 133 | 'table_name' => 'civicrm_county', |
134 | 'entity' => 'County', | |
135 | 'bao' => 'CRM_Core_DAO_County', | |
6a7e5e5d | 136 | 'localizable' => 0, |
2cbbebe8 A |
137 | 'html' => [ |
138 | 'type' => 'Number', | |
139 | ], | |
1fe423d6 | 140 | 'readonly' => TRUE, |
a9d0587b | 141 | 'add' => '1.1', |
c3fc2621 CW |
142 | ], |
143 | 'name' => [ | |
e501603b TO |
144 | 'name' => 'name', |
145 | 'type' => CRM_Utils_Type::T_STRING, | |
c3fc2621 | 146 | 'title' => ts('County'), |
215b423e | 147 | 'description' => ts('Name of County'), |
e501603b TO |
148 | 'maxlength' => 64, |
149 | 'size' => CRM_Utils_Type::BIG, | |
c3fc2621 | 150 | 'import' => TRUE, |
e501603b TO |
151 | 'where' => 'civicrm_county.name', |
152 | 'headerPattern' => '/county/i', | |
153 | 'dataPattern' => '/[A-Z]{2}/', | |
c3fc2621 | 154 | 'export' => TRUE, |
522a26c9 | 155 | 'table_name' => 'civicrm_county', |
156 | 'entity' => 'County', | |
157 | 'bao' => 'CRM_Core_DAO_County', | |
6a7e5e5d | 158 | 'localizable' => 0, |
a9d0587b | 159 | 'add' => '1.1', |
c3fc2621 CW |
160 | ], |
161 | 'abbreviation' => [ | |
e501603b TO |
162 | 'name' => 'abbreviation', |
163 | 'type' => CRM_Utils_Type::T_STRING, | |
c3fc2621 | 164 | 'title' => ts('County Abbreviation'), |
215b423e | 165 | 'description' => ts('2-4 Character Abbreviation of County'), |
e501603b TO |
166 | 'maxlength' => 4, |
167 | 'size' => CRM_Utils_Type::FOUR, | |
a36434b9 | 168 | 'where' => 'civicrm_county.abbreviation', |
522a26c9 | 169 | 'table_name' => 'civicrm_county', |
170 | 'entity' => 'County', | |
171 | 'bao' => 'CRM_Core_DAO_County', | |
6a7e5e5d | 172 | 'localizable' => 0, |
a9d0587b | 173 | 'add' => '1.1', |
c3fc2621 CW |
174 | ], |
175 | 'state_province_id' => [ | |
e501603b TO |
176 | 'name' => 'state_province_id', |
177 | 'type' => CRM_Utils_Type::T_INT, | |
2cbbebe8 | 178 | 'title' => ts('State ID'), |
215b423e | 179 | 'description' => ts('ID of State/Province that County belongs'), |
c3fc2621 | 180 | 'required' => TRUE, |
a36434b9 | 181 | 'where' => 'civicrm_county.state_province_id', |
522a26c9 | 182 | 'table_name' => 'civicrm_county', |
183 | 'entity' => 'County', | |
184 | 'bao' => 'CRM_Core_DAO_County', | |
6a7e5e5d | 185 | 'localizable' => 0, |
e501603b | 186 | 'FKClassName' => 'CRM_Core_DAO_StateProvince', |
2cbbebe8 A |
187 | 'html' => [ |
188 | 'label' => ts("State"), | |
189 | ], | |
96012881 PN |
190 | 'pseudoconstant' => [ |
191 | 'table' => 'civicrm_state_province', | |
192 | 'keyColumn' => 'id', | |
193 | 'labelColumn' => 'name', | |
70c5cd97 | 194 | 'abbrColumn' => 'abbreviation', |
96012881 | 195 | ], |
a9d0587b | 196 | 'add' => '1.1', |
c3fc2621 | 197 | ], |
005f02ec MW |
198 | 'is_active' => [ |
199 | 'name' => 'is_active', | |
200 | 'type' => CRM_Utils_Type::T_BOOLEAN, | |
201 | 'title' => ts('County Is Active'), | |
202 | 'description' => ts('Is this County active?'), | |
203 | 'where' => 'civicrm_county.is_active', | |
204 | 'default' => '1', | |
205 | 'table_name' => 'civicrm_county', | |
206 | 'entity' => 'County', | |
207 | 'bao' => 'CRM_Core_DAO_County', | |
208 | 'localizable' => 0, | |
209 | 'add' => '5.35', | |
210 | ], | |
c3fc2621 | 211 | ]; |
346aaaba | 212 | CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']); |
e501603b | 213 | } |
346aaaba | 214 | return Civi::$statics[__CLASS__]['fields']; |
e501603b | 215 | } |
c3fc2621 | 216 | |
e501603b | 217 | /** |
bd8e0b14 | 218 | * Return a mapping from field-name to the corresponding key (as used in fields()). |
e501603b TO |
219 | * |
220 | * @return array | |
bd8e0b14 | 221 | * Array(string $name => string $uniqueName). |
e501603b | 222 | */ |
c3fc2621 | 223 | public static function &fieldKeys() { |
bd8e0b14 TO |
224 | if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) { |
225 | Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields())); | |
e501603b | 226 | } |
bd8e0b14 | 227 | return Civi::$statics[__CLASS__]['fieldKeys']; |
e501603b | 228 | } |
c3fc2621 | 229 | |
e501603b TO |
230 | /** |
231 | * Returns the names of this table | |
232 | * | |
233 | * @return string | |
234 | */ | |
c3fc2621 | 235 | public static function getTableName() { |
e501603b TO |
236 | return self::$_tableName; |
237 | } | |
c3fc2621 | 238 | |
e501603b TO |
239 | /** |
240 | * Returns if this table needs to be logged | |
241 | * | |
c3fc2621 | 242 | * @return bool |
e501603b | 243 | */ |
c3fc2621 | 244 | public function getLog() { |
e501603b TO |
245 | return self::$_log; |
246 | } | |
c3fc2621 | 247 | |
e501603b TO |
248 | /** |
249 | * Returns the list of fields that can be imported | |
250 | * | |
251 | * @param bool $prefix | |
252 | * | |
253 | * @return array | |
254 | */ | |
c3fc2621 CW |
255 | public static function &import($prefix = FALSE) { |
256 | $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'county', $prefix, []); | |
60808919 | 257 | return $r; |
e501603b | 258 | } |
c3fc2621 | 259 | |
e501603b TO |
260 | /** |
261 | * Returns the list of fields that can be exported | |
262 | * | |
263 | * @param bool $prefix | |
264 | * | |
265 | * @return array | |
266 | */ | |
c3fc2621 CW |
267 | public static function &export($prefix = FALSE) { |
268 | $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'county', $prefix, []); | |
60808919 | 269 | return $r; |
e501603b | 270 | } |
c3fc2621 | 271 | |
e7a6b91a AS |
272 | /** |
273 | * Returns the list of indices | |
c3fc2621 CW |
274 | * |
275 | * @param bool $localize | |
276 | * | |
277 | * @return array | |
e7a6b91a AS |
278 | */ |
279 | public static function indices($localize = TRUE) { | |
c3fc2621 CW |
280 | $indices = [ |
281 | 'UI_name_state_id' => [ | |
e7a6b91a | 282 | 'name' => 'UI_name_state_id', |
c3fc2621 | 283 | 'field' => [ |
e7a6b91a AS |
284 | 0 => 'name', |
285 | 1 => 'state_province_id', | |
c3fc2621 CW |
286 | ], |
287 | 'localizable' => FALSE, | |
288 | 'unique' => TRUE, | |
e7a6b91a | 289 | 'sig' => 'civicrm_county::1::name::state_province_id', |
c3fc2621 CW |
290 | ], |
291 | ]; | |
e7a6b91a AS |
292 | return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices; |
293 | } | |
c3fc2621 | 294 | |
e501603b | 295 | } |