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:5620d2136c764c786eef1c15853eaf9b)
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.
73 * Whether to return the plural version of the title.
75 public static function getEntityTitle($plural = FALSE) {
76 return $plural ?
ts('Counties') : ts('County');
80 * Returns foreign keys and entity references.
83 * [CRM_Core_Reference_Interface]
85 public static function getReferenceColumns() {
86 if (!isset(Civi
::$statics[__CLASS__
]['links'])) {
87 Civi
::$statics[__CLASS__
]['links'] = static::createReferenceColumns(__CLASS__
);
88 Civi
::$statics[__CLASS__
]['links'][] = new CRM_Core_Reference_Basic(self
::getTableName(), 'state_province_id', 'civicrm_state_province', 'id');
89 CRM_Core_DAO_AllCoreTables
::invoke(__CLASS__
, 'links_callback', Civi
::$statics[__CLASS__
]['links']);
91 return Civi
::$statics[__CLASS__
]['links'];
95 * Returns all the column names of this table
99 public static function &fields() {
100 if (!isset(Civi
::$statics[__CLASS__
]['fields'])) {
101 Civi
::$statics[__CLASS__
]['fields'] = [
104 'type' => CRM_Utils_Type
::T_INT
,
105 'title' => ts('County ID'),
106 'description' => ts('County ID'),
108 'where' => 'civicrm_county.id',
109 'table_name' => 'civicrm_county',
110 'entity' => 'County',
111 'bao' => 'CRM_Core_DAO_County',
117 'type' => CRM_Utils_Type
::T_STRING
,
118 'title' => ts('County'),
119 'description' => ts('Name of County'),
121 'size' => CRM_Utils_Type
::BIG
,
123 'where' => 'civicrm_county.name',
124 'headerPattern' => '/county/i',
125 'dataPattern' => '/[A-Z]{2}/',
127 'table_name' => 'civicrm_county',
128 'entity' => 'County',
129 'bao' => 'CRM_Core_DAO_County',
134 'name' => 'abbreviation',
135 'type' => CRM_Utils_Type
::T_STRING
,
136 'title' => ts('County Abbreviation'),
137 'description' => ts('2-4 Character Abbreviation of County'),
139 'size' => CRM_Utils_Type
::FOUR
,
140 'where' => 'civicrm_county.abbreviation',
141 'table_name' => 'civicrm_county',
142 'entity' => 'County',
143 'bao' => 'CRM_Core_DAO_County',
147 'state_province_id' => [
148 'name' => 'state_province_id',
149 'type' => CRM_Utils_Type
::T_INT
,
150 'title' => ts('State'),
151 'description' => ts('ID of State/Province that County belongs'),
153 'where' => 'civicrm_county.state_province_id',
154 'table_name' => 'civicrm_county',
155 'entity' => 'County',
156 'bao' => 'CRM_Core_DAO_County',
158 'FKClassName' => 'CRM_Core_DAO_StateProvince',
159 'pseudoconstant' => [
160 'table' => 'civicrm_state_province',
162 'labelColumn' => 'name',
167 CRM_Core_DAO_AllCoreTables
::invoke(__CLASS__
, 'fields_callback', Civi
::$statics[__CLASS__
]['fields']);
169 return Civi
::$statics[__CLASS__
]['fields'];
173 * Return a mapping from field-name to the corresponding key (as used in fields()).
176 * Array(string $name => string $uniqueName).
178 public static function &fieldKeys() {
179 if (!isset(Civi
::$statics[__CLASS__
]['fieldKeys'])) {
180 Civi
::$statics[__CLASS__
]['fieldKeys'] = array_flip(CRM_Utils_Array
::collect('name', self
::fields()));
182 return Civi
::$statics[__CLASS__
]['fieldKeys'];
186 * Returns the names of this table
190 public static function getTableName() {
191 return self
::$_tableName;
195 * Returns if this table needs to be logged
199 public function getLog() {
204 * Returns the list of fields that can be imported
206 * @param bool $prefix
210 public static function &import($prefix = FALSE) {
211 $r = CRM_Core_DAO_AllCoreTables
::getImports(__CLASS__
, 'county', $prefix, []);
216 * Returns the list of fields that can be exported
218 * @param bool $prefix
222 public static function &export($prefix = FALSE) {
223 $r = CRM_Core_DAO_AllCoreTables
::getExports(__CLASS__
, 'county', $prefix, []);
228 * Returns the list of indices
230 * @param bool $localize
234 public static function indices($localize = TRUE) {
236 'UI_name_state_id' => [
237 'name' => 'UI_name_state_id',
240 1 => 'state_province_id',
242 'localizable' => FALSE,
244 'sig' => 'civicrm_county::1::name::state_province_id',
247 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables
::multilingualize(__CLASS__
, $indices) : $indices;