5 * @copyright CiviCRM LLC https://civicrm.org/licensing
7 * Generated from xml/schema/CRM/Core/County.xml
8 * DO NOT EDIT. Generated by CRM_Core_CodeGen
9 * (GenCodeChecksum:095ad13ad08bd1d3c12be5094239df32)
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 localized title of this entity.
70 public static function getEntityTitle() {
71 return ts('Counties');
75 * Returns foreign keys and entity references.
78 * [CRM_Core_Reference_Interface]
80 public static function getReferenceColumns() {
81 if (!isset(Civi
::$statics[__CLASS__
]['links'])) {
82 Civi
::$statics[__CLASS__
]['links'] = static::createReferenceColumns(__CLASS__
);
83 Civi
::$statics[__CLASS__
]['links'][] = new CRM_Core_Reference_Basic(self
::getTableName(), 'state_province_id', 'civicrm_state_province', 'id');
84 CRM_Core_DAO_AllCoreTables
::invoke(__CLASS__
, 'links_callback', Civi
::$statics[__CLASS__
]['links']);
86 return Civi
::$statics[__CLASS__
]['links'];
90 * Returns all the column names of this table
94 public static function &fields() {
95 if (!isset(Civi
::$statics[__CLASS__
]['fields'])) {
96 Civi
::$statics[__CLASS__
]['fields'] = [
99 'type' => CRM_Utils_Type
::T_INT
,
100 'title' => ts('County ID'),
101 'description' => ts('County ID'),
103 'where' => 'civicrm_county.id',
104 'table_name' => 'civicrm_county',
105 'entity' => 'County',
106 'bao' => 'CRM_Core_DAO_County',
112 'type' => CRM_Utils_Type
::T_STRING
,
113 'title' => ts('County'),
114 'description' => ts('Name of County'),
116 'size' => CRM_Utils_Type
::BIG
,
118 'where' => 'civicrm_county.name',
119 'headerPattern' => '/county/i',
120 'dataPattern' => '/[A-Z]{2}/',
122 'table_name' => 'civicrm_county',
123 'entity' => 'County',
124 'bao' => 'CRM_Core_DAO_County',
129 'name' => 'abbreviation',
130 'type' => CRM_Utils_Type
::T_STRING
,
131 'title' => ts('County Abbreviation'),
132 'description' => ts('2-4 Character Abbreviation of County'),
134 'size' => CRM_Utils_Type
::FOUR
,
135 'where' => 'civicrm_county.abbreviation',
136 'table_name' => 'civicrm_county',
137 'entity' => 'County',
138 'bao' => 'CRM_Core_DAO_County',
142 'state_province_id' => [
143 'name' => 'state_province_id',
144 'type' => CRM_Utils_Type
::T_INT
,
145 'title' => ts('State'),
146 'description' => ts('ID of State/Province that County belongs'),
148 'where' => 'civicrm_county.state_province_id',
149 'table_name' => 'civicrm_county',
150 'entity' => 'County',
151 'bao' => 'CRM_Core_DAO_County',
153 'FKClassName' => 'CRM_Core_DAO_StateProvince',
154 'pseudoconstant' => [
155 'table' => 'civicrm_state_province',
157 'labelColumn' => 'name',
162 CRM_Core_DAO_AllCoreTables
::invoke(__CLASS__
, 'fields_callback', Civi
::$statics[__CLASS__
]['fields']);
164 return Civi
::$statics[__CLASS__
]['fields'];
168 * Return a mapping from field-name to the corresponding key (as used in fields()).
171 * Array(string $name => string $uniqueName).
173 public static function &fieldKeys() {
174 if (!isset(Civi
::$statics[__CLASS__
]['fieldKeys'])) {
175 Civi
::$statics[__CLASS__
]['fieldKeys'] = array_flip(CRM_Utils_Array
::collect('name', self
::fields()));
177 return Civi
::$statics[__CLASS__
]['fieldKeys'];
181 * Returns the names of this table
185 public static function getTableName() {
186 return self
::$_tableName;
190 * Returns if this table needs to be logged
194 public function getLog() {
199 * Returns the list of fields that can be imported
201 * @param bool $prefix
205 public static function &import($prefix = FALSE) {
206 $r = CRM_Core_DAO_AllCoreTables
::getImports(__CLASS__
, 'county', $prefix, []);
211 * Returns the list of fields that can be exported
213 * @param bool $prefix
217 public static function &export($prefix = FALSE) {
218 $r = CRM_Core_DAO_AllCoreTables
::getExports(__CLASS__
, 'county', $prefix, []);
223 * Returns the list of indices
225 * @param bool $localize
229 public static function indices($localize = TRUE) {
231 'UI_name_state_id' => [
232 'name' => 'UI_name_state_id',
235 1 => 'state_province_id',
237 'localizable' => FALSE,
239 'sig' => 'civicrm_county::1::name::state_province_id',
242 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables
::multilingualize(__CLASS__
, $indices) : $indices;