5 * @copyright CiviCRM LLC (c) 2004-2020
7 * Generated from xml/schema/CRM/Core/County.xml
8 * DO NOT EDIT. Generated by CRM_Core_CodeGen
9 * (GenCodeChecksum:4ba037c52adafa1cf164bc0a3dca2102)
13 * Database access object for the County entity.
15 class CRM_Core_DAO_County
extends CRM_Core_DAO
{
18 * Static instance to hold the table name.
22 public static $_tableName = 'civicrm_county';
25 * Should CiviCRM log any modifications to this table in the civicrm_log table.
29 public static $_log = FALSE;
46 * 2-4 Character Abbreviation of County
53 * ID of State/Province that County belongs
57 public $state_province_id;
62 public function __construct() {
63 $this->__table
= 'civicrm_county';
64 parent
::__construct();
68 * Returns foreign keys and entity references.
71 * [CRM_Core_Reference_Interface]
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']);
79 return Civi
::$statics[__CLASS__
]['links'];
83 * Returns all the column names of this table
87 public static function &fields() {
88 if (!isset(Civi
::$statics[__CLASS__
]['fields'])) {
89 Civi
::$statics[__CLASS__
]['fields'] = [
92 'type' => CRM_Utils_Type
::T_INT
,
93 'title' => ts('County ID'),
94 'description' => ts('County ID'),
96 'where' => 'civicrm_county.id',
97 'table_name' => 'civicrm_county',
99 'bao' => 'CRM_Core_DAO_County',
104 'type' => CRM_Utils_Type
::T_STRING
,
105 'title' => ts('County'),
106 'description' => ts('Name of County'),
108 'size' => CRM_Utils_Type
::BIG
,
110 'where' => 'civicrm_county.name',
111 'headerPattern' => '/county/i',
112 'dataPattern' => '/[A-Z]{2}/',
114 'table_name' => 'civicrm_county',
115 'entity' => 'County',
116 'bao' => 'CRM_Core_DAO_County',
120 'name' => 'abbreviation',
121 'type' => CRM_Utils_Type
::T_STRING
,
122 'title' => ts('County Abbreviation'),
123 'description' => ts('2-4 Character Abbreviation of County'),
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',
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'),
138 'where' => 'civicrm_county.state_province_id',
139 'table_name' => 'civicrm_county',
140 'entity' => 'County',
141 'bao' => 'CRM_Core_DAO_County',
143 'FKClassName' => 'CRM_Core_DAO_StateProvince',
146 CRM_Core_DAO_AllCoreTables
::invoke(__CLASS__
, 'fields_callback', Civi
::$statics[__CLASS__
]['fields']);
148 return Civi
::$statics[__CLASS__
]['fields'];
152 * Return a mapping from field-name to the corresponding key (as used in fields()).
155 * Array(string $name => string $uniqueName).
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()));
161 return Civi
::$statics[__CLASS__
]['fieldKeys'];
165 * Returns the names of this table
169 public static function getTableName() {
170 return self
::$_tableName;
174 * Returns if this table needs to be logged
178 public function getLog() {
183 * Returns the list of fields that can be imported
185 * @param bool $prefix
189 public static function &import($prefix = FALSE) {
190 $r = CRM_Core_DAO_AllCoreTables
::getImports(__CLASS__
, 'county', $prefix, []);
195 * Returns the list of fields that can be exported
197 * @param bool $prefix
201 public static function &export($prefix = FALSE) {
202 $r = CRM_Core_DAO_AllCoreTables
::getExports(__CLASS__
, 'county', $prefix, []);
207 * Returns the list of indices
209 * @param bool $localize
213 public static function indices($localize = TRUE) {
215 'UI_name_state_id' => [
216 'name' => 'UI_name_state_id',
219 1 => 'state_province_id',
221 'localizable' => FALSE,
223 'sig' => 'civicrm_county::1::name::state_province_id',
226 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables
::multilingualize(__CLASS__
, $indices) : $indices;