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