Regenerate DAO files
[civicrm-core.git] / CRM / Core / DAO / County.php
1 <?php
2
3 /**
4 * @package CRM
5 * @copyright CiviCRM LLC (c) 2004-2019
6 *
7 * Generated from xml/schema/CRM/Core/County.xml
8 * DO NOT EDIT. Generated by CRM_Core_CodeGen
9 * (GenCodeChecksum:3ce3045eed44f727cbca947945315329)
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 ],
145 ];
146 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']);
147 }
148 return Civi::$statics[__CLASS__]['fields'];
149 }
150
151 /**
152 * Return a mapping from field-name to the corresponding key (as used in fields()).
153 *
154 * @return array
155 * Array(string $name => string $uniqueName).
156 */
157 public static function &fieldKeys() {
158 if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) {
159 Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields()));
160 }
161 return Civi::$statics[__CLASS__]['fieldKeys'];
162 }
163
164 /**
165 * Returns the names of this table
166 *
167 * @return string
168 */
169 public static function getTableName() {
170 return self::$_tableName;
171 }
172
173 /**
174 * Returns if this table needs to be logged
175 *
176 * @return bool
177 */
178 public function getLog() {
179 return self::$_log;
180 }
181
182 /**
183 * Returns the list of fields that can be imported
184 *
185 * @param bool $prefix
186 *
187 * @return array
188 */
189 public static function &import($prefix = FALSE) {
190 $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'county', $prefix, []);
191 return $r;
192 }
193
194 /**
195 * Returns the list of fields that can be exported
196 *
197 * @param bool $prefix
198 *
199 * @return array
200 */
201 public static function &export($prefix = FALSE) {
202 $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'county', $prefix, []);
203 return $r;
204 }
205
206 /**
207 * Returns the list of indices
208 *
209 * @param bool $localize
210 *
211 * @return array
212 */
213 public static function indices($localize = TRUE) {
214 $indices = [
215 'UI_name_state_id' => [
216 'name' => 'UI_name_state_id',
217 'field' => [
218 0 => 'name',
219 1 => 'state_province_id',
220 ],
221 'localizable' => FALSE,
222 'unique' => TRUE,
223 'sig' => 'civicrm_county::1::name::state_province_id',
224 ],
225 ];
226 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices;
227 }
228
229 }