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:96f94dbbafff9a4e1f0ff276799fcbbd)
13 * Database access object for the County entity.
15 class CRM_Core_DAO_County
extends CRM_Core_DAO
{
16 const EXT
= 'civicrm';
17 const TABLE_ADDED
= '1.1';
20 * Static instance to hold the table name.
24 public static $_tableName = 'civicrm_county';
27 * Should CiviCRM log any modifications to this table in the civicrm_log table.
31 public static $_log = FALSE;
48 * 2-4 Character Abbreviation of County
55 * ID of State/Province that County belongs
59 public $state_province_id;
64 public function __construct() {
65 $this->__table
= 'civicrm_county';
66 parent
::__construct();
70 * Returns localized title of this entity.
72 public static function getEntityTitle() {
73 return ts('Counties');
77 * Returns foreign keys and entity references.
80 * [CRM_Core_Reference_Interface]
82 public static function getReferenceColumns() {
83 if (!isset(Civi
::$statics[__CLASS__
]['links'])) {
84 Civi
::$statics[__CLASS__
]['links'] = static::createReferenceColumns(__CLASS__
);
85 Civi
::$statics[__CLASS__
]['links'][] = new CRM_Core_Reference_Basic(self
::getTableName(), 'state_province_id', 'civicrm_state_province', 'id');
86 CRM_Core_DAO_AllCoreTables
::invoke(__CLASS__
, 'links_callback', Civi
::$statics[__CLASS__
]['links']);
88 return Civi
::$statics[__CLASS__
]['links'];
92 * Returns all the column names of this table
96 public static function &fields() {
97 if (!isset(Civi
::$statics[__CLASS__
]['fields'])) {
98 Civi
::$statics[__CLASS__
]['fields'] = [
101 'type' => CRM_Utils_Type
::T_INT
,
102 'title' => ts('County ID'),
103 'description' => ts('County ID'),
105 'where' => 'civicrm_county.id',
106 'table_name' => 'civicrm_county',
107 'entity' => 'County',
108 'bao' => 'CRM_Core_DAO_County',
114 'type' => CRM_Utils_Type
::T_STRING
,
115 'title' => ts('County'),
116 'description' => ts('Name of County'),
118 'size' => CRM_Utils_Type
::BIG
,
120 'where' => 'civicrm_county.name',
121 'headerPattern' => '/county/i',
122 'dataPattern' => '/[A-Z]{2}/',
124 'table_name' => 'civicrm_county',
125 'entity' => 'County',
126 'bao' => 'CRM_Core_DAO_County',
131 'name' => 'abbreviation',
132 'type' => CRM_Utils_Type
::T_STRING
,
133 'title' => ts('County Abbreviation'),
134 'description' => ts('2-4 Character Abbreviation of County'),
136 'size' => CRM_Utils_Type
::FOUR
,
137 'where' => 'civicrm_county.abbreviation',
138 'table_name' => 'civicrm_county',
139 'entity' => 'County',
140 'bao' => 'CRM_Core_DAO_County',
144 'state_province_id' => [
145 'name' => 'state_province_id',
146 'type' => CRM_Utils_Type
::T_INT
,
147 'title' => ts('State'),
148 'description' => ts('ID of State/Province that County belongs'),
150 'where' => 'civicrm_county.state_province_id',
151 'table_name' => 'civicrm_county',
152 'entity' => 'County',
153 'bao' => 'CRM_Core_DAO_County',
155 'FKClassName' => 'CRM_Core_DAO_StateProvince',
156 'pseudoconstant' => [
157 'table' => 'civicrm_state_province',
159 'labelColumn' => 'name',
164 CRM_Core_DAO_AllCoreTables
::invoke(__CLASS__
, 'fields_callback', Civi
::$statics[__CLASS__
]['fields']);
166 return Civi
::$statics[__CLASS__
]['fields'];
170 * Return a mapping from field-name to the corresponding key (as used in fields()).
173 * Array(string $name => string $uniqueName).
175 public static function &fieldKeys() {
176 if (!isset(Civi
::$statics[__CLASS__
]['fieldKeys'])) {
177 Civi
::$statics[__CLASS__
]['fieldKeys'] = array_flip(CRM_Utils_Array
::collect('name', self
::fields()));
179 return Civi
::$statics[__CLASS__
]['fieldKeys'];
183 * Returns the names of this table
187 public static function getTableName() {
188 return self
::$_tableName;
192 * Returns if this table needs to be logged
196 public function getLog() {
201 * Returns the list of fields that can be imported
203 * @param bool $prefix
207 public static function &import($prefix = FALSE) {
208 $r = CRM_Core_DAO_AllCoreTables
::getImports(__CLASS__
, 'county', $prefix, []);
213 * Returns the list of fields that can be exported
215 * @param bool $prefix
219 public static function &export($prefix = FALSE) {
220 $r = CRM_Core_DAO_AllCoreTables
::getExports(__CLASS__
, 'county', $prefix, []);
225 * Returns the list of indices
227 * @param bool $localize
231 public static function indices($localize = TRUE) {
233 'UI_name_state_id' => [
234 'name' => 'UI_name_state_id',
237 1 => 'state_province_id',
239 'localizable' => FALSE,
241 'sig' => 'civicrm_county::1::name::state_province_id',
244 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables
::multilingualize(__CLASS__
, $indices) : $indices;