Regenerate DAO files
[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:a03d29b83399e1ef92de3a6e5861adb4)
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
44 */
45 public $id;
46
47 /**
48 * Name of County
49 *
50 * @var string
51 */
52 public $name;
53
54 /**
55 * 2-4 Character Abbreviation of County
56 *
57 * @var string
58 */
59 public $abbreviation;
60
61 /**
62 * ID of State/Province that County belongs
63 *
64 * @var int
65 */
66 public $state_province_id;
67
68 /**
69 * Is this County active?
70 *
71 * @var bool
72 */
73 public $is_active;
74
75 /**
76 * Class constructor.
77 */
78 public function __construct() {
79 $this->__table = 'civicrm_county';
80 parent::__construct();
81 }
82
83 /**
84 * Returns localized title of this entity.
85 *
86 * @param bool $plural
87 * Whether to return the plural version of the title.
88 */
89 public static function getEntityTitle($plural = FALSE) {
90 return $plural ? ts('Counties') : ts('County');
91 }
92
93 /**
94 * Returns foreign keys and entity references.
95 *
96 * @return array
97 * [CRM_Core_Reference_Interface]
98 */
99 public static function getReferenceColumns() {
100 if (!isset(Civi::$statics[__CLASS__]['links'])) {
101 Civi::$statics[__CLASS__]['links'] = static::createReferenceColumns(__CLASS__);
102 Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'state_province_id', 'civicrm_state_province', 'id');
103 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'links_callback', Civi::$statics[__CLASS__]['links']);
104 }
105 return Civi::$statics[__CLASS__]['links'];
106 }
107
108 /**
109 * Returns all the column names of this table
110 *
111 * @return array
112 */
113 public static function &fields() {
114 if (!isset(Civi::$statics[__CLASS__]['fields'])) {
115 Civi::$statics[__CLASS__]['fields'] = [
116 'id' => [
117 'name' => 'id',
118 'type' => CRM_Utils_Type::T_INT,
119 'title' => ts('County ID'),
120 'description' => ts('County ID'),
121 'required' => TRUE,
122 'where' => 'civicrm_county.id',
123 'table_name' => 'civicrm_county',
124 'entity' => 'County',
125 'bao' => 'CRM_Core_DAO_County',
126 'localizable' => 0,
127 'html' => [
128 'type' => 'Number',
129 ],
130 'add' => '1.1',
131 ],
132 'name' => [
133 'name' => 'name',
134 'type' => CRM_Utils_Type::T_STRING,
135 'title' => ts('County'),
136 'description' => ts('Name of County'),
137 'maxlength' => 64,
138 'size' => CRM_Utils_Type::BIG,
139 'import' => TRUE,
140 'where' => 'civicrm_county.name',
141 'headerPattern' => '/county/i',
142 'dataPattern' => '/[A-Z]{2}/',
143 'export' => TRUE,
144 'table_name' => 'civicrm_county',
145 'entity' => 'County',
146 'bao' => 'CRM_Core_DAO_County',
147 'localizable' => 0,
148 'add' => '1.1',
149 ],
150 'abbreviation' => [
151 'name' => 'abbreviation',
152 'type' => CRM_Utils_Type::T_STRING,
153 'title' => ts('County Abbreviation'),
154 'description' => ts('2-4 Character Abbreviation of County'),
155 'maxlength' => 4,
156 'size' => CRM_Utils_Type::FOUR,
157 'where' => 'civicrm_county.abbreviation',
158 'table_name' => 'civicrm_county',
159 'entity' => 'County',
160 'bao' => 'CRM_Core_DAO_County',
161 'localizable' => 0,
162 'add' => '1.1',
163 ],
164 'state_province_id' => [
165 'name' => 'state_province_id',
166 'type' => CRM_Utils_Type::T_INT,
167 'title' => ts('State ID'),
168 'description' => ts('ID of State/Province that County belongs'),
169 'required' => TRUE,
170 'where' => 'civicrm_county.state_province_id',
171 'table_name' => 'civicrm_county',
172 'entity' => 'County',
173 'bao' => 'CRM_Core_DAO_County',
174 'localizable' => 0,
175 'FKClassName' => 'CRM_Core_DAO_StateProvince',
176 'html' => [
177 'label' => ts("State"),
178 ],
179 'pseudoconstant' => [
180 'table' => 'civicrm_state_province',
181 'keyColumn' => 'id',
182 'labelColumn' => 'name',
183 ],
184 'add' => '1.1',
185 ],
186 'is_active' => [
187 'name' => 'is_active',
188 'type' => CRM_Utils_Type::T_BOOLEAN,
189 'title' => ts('County Is Active'),
190 'description' => ts('Is this County active?'),
191 'where' => 'civicrm_county.is_active',
192 'default' => '1',
193 'table_name' => 'civicrm_county',
194 'entity' => 'County',
195 'bao' => 'CRM_Core_DAO_County',
196 'localizable' => 0,
197 'add' => '5.35',
198 ],
199 ];
200 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']);
201 }
202 return Civi::$statics[__CLASS__]['fields'];
203 }
204
205 /**
206 * Return a mapping from field-name to the corresponding key (as used in fields()).
207 *
208 * @return array
209 * Array(string $name => string $uniqueName).
210 */
211 public static function &fieldKeys() {
212 if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) {
213 Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields()));
214 }
215 return Civi::$statics[__CLASS__]['fieldKeys'];
216 }
217
218 /**
219 * Returns the names of this table
220 *
221 * @return string
222 */
223 public static function getTableName() {
224 return self::$_tableName;
225 }
226
227 /**
228 * Returns if this table needs to be logged
229 *
230 * @return bool
231 */
232 public function getLog() {
233 return self::$_log;
234 }
235
236 /**
237 * Returns the list of fields that can be imported
238 *
239 * @param bool $prefix
240 *
241 * @return array
242 */
243 public static function &import($prefix = FALSE) {
244 $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'county', $prefix, []);
245 return $r;
246 }
247
248 /**
249 * Returns the list of fields that can be exported
250 *
251 * @param bool $prefix
252 *
253 * @return array
254 */
255 public static function &export($prefix = FALSE) {
256 $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'county', $prefix, []);
257 return $r;
258 }
259
260 /**
261 * Returns the list of indices
262 *
263 * @param bool $localize
264 *
265 * @return array
266 */
267 public static function indices($localize = TRUE) {
268 $indices = [
269 'UI_name_state_id' => [
270 'name' => 'UI_name_state_id',
271 'field' => [
272 0 => 'name',
273 1 => 'state_province_id',
274 ],
275 'localizable' => FALSE,
276 'unique' => TRUE,
277 'sig' => 'civicrm_county::1::name::state_province_id',
278 ],
279 ];
280 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices;
281 }
282
283 }