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 | |
0d902ab8 | 9 | * (GenCodeChecksum:3b5b06caf78948fe6bbbafe831c2aa96) |
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 | * | |
0d902ab8 | 79 | * @var bool|string |
28979d65 CW |
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?'), | |
0d902ab8 | 203 | 'required' => TRUE, |
005f02ec MW |
204 | 'where' => 'civicrm_county.is_active', |
205 | 'default' => '1', | |
206 | 'table_name' => 'civicrm_county', | |
207 | 'entity' => 'County', | |
208 | 'bao' => 'CRM_Core_DAO_County', | |
209 | 'localizable' => 0, | |
210 | 'add' => '5.35', | |
211 | ], | |
c3fc2621 | 212 | ]; |
346aaaba | 213 | CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']); |
e501603b | 214 | } |
346aaaba | 215 | return Civi::$statics[__CLASS__]['fields']; |
e501603b | 216 | } |
c3fc2621 | 217 | |
e501603b | 218 | /** |
bd8e0b14 | 219 | * Return a mapping from field-name to the corresponding key (as used in fields()). |
e501603b TO |
220 | * |
221 | * @return array | |
bd8e0b14 | 222 | * Array(string $name => string $uniqueName). |
e501603b | 223 | */ |
c3fc2621 | 224 | public static function &fieldKeys() { |
bd8e0b14 TO |
225 | if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) { |
226 | Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields())); | |
e501603b | 227 | } |
bd8e0b14 | 228 | return Civi::$statics[__CLASS__]['fieldKeys']; |
e501603b | 229 | } |
c3fc2621 | 230 | |
e501603b TO |
231 | /** |
232 | * Returns the names of this table | |
233 | * | |
234 | * @return string | |
235 | */ | |
c3fc2621 | 236 | public static function getTableName() { |
e501603b TO |
237 | return self::$_tableName; |
238 | } | |
c3fc2621 | 239 | |
e501603b TO |
240 | /** |
241 | * Returns if this table needs to be logged | |
242 | * | |
c3fc2621 | 243 | * @return bool |
e501603b | 244 | */ |
c3fc2621 | 245 | public function getLog() { |
e501603b TO |
246 | return self::$_log; |
247 | } | |
c3fc2621 | 248 | |
e501603b TO |
249 | /** |
250 | * Returns the list of fields that can be imported | |
251 | * | |
252 | * @param bool $prefix | |
253 | * | |
254 | * @return array | |
255 | */ | |
c3fc2621 CW |
256 | public static function &import($prefix = FALSE) { |
257 | $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'county', $prefix, []); | |
60808919 | 258 | return $r; |
e501603b | 259 | } |
c3fc2621 | 260 | |
e501603b TO |
261 | /** |
262 | * Returns the list of fields that can be exported | |
263 | * | |
264 | * @param bool $prefix | |
265 | * | |
266 | * @return array | |
267 | */ | |
c3fc2621 CW |
268 | public static function &export($prefix = FALSE) { |
269 | $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'county', $prefix, []); | |
60808919 | 270 | return $r; |
e501603b | 271 | } |
c3fc2621 | 272 | |
e7a6b91a AS |
273 | /** |
274 | * Returns the list of indices | |
c3fc2621 CW |
275 | * |
276 | * @param bool $localize | |
277 | * | |
278 | * @return array | |
e7a6b91a AS |
279 | */ |
280 | public static function indices($localize = TRUE) { | |
c3fc2621 CW |
281 | $indices = [ |
282 | 'UI_name_state_id' => [ | |
e7a6b91a | 283 | 'name' => 'UI_name_state_id', |
c3fc2621 | 284 | 'field' => [ |
e7a6b91a AS |
285 | 0 => 'name', |
286 | 1 => 'state_province_id', | |
c3fc2621 CW |
287 | ], |
288 | 'localizable' => FALSE, | |
289 | 'unique' => TRUE, | |
e7a6b91a | 290 | 'sig' => 'civicrm_county::1::name::state_province_id', |
c3fc2621 CW |
291 | ], |
292 | ]; | |
e7a6b91a AS |
293 | return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices; |
294 | } | |
c3fc2621 | 295 | |
e501603b | 296 | } |