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:483d29dbf44ee6e0805f062f90a1d4e9)
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 * Field to show when displaying a record.
31 public static $_labelField = 'name';
34 * Should CiviCRM log any modifications to this table in the civicrm_log table.
38 public static $_log = FALSE;
55 * 2-4 Character Abbreviation of County
62 * ID of State/Province that County belongs
66 public $state_province_id;
69 * Is this County active?
78 public function __construct() {
79 $this->__table
= 'civicrm_county';
80 parent
::__construct();
84 * Returns localized title of this entity.
87 * Whether to return the plural version of the title.
89 public static function getEntityTitle($plural = FALSE) {
90 return $plural ?
ts('Counties') : ts('County');
94 * Returns foreign keys and entity references.
97 * [CRM_Core_Reference_Interface]
99 public static function getReferenceColumns() {
100 if (!isset(Civi
::$statics[__CLASS__
]['links'])) {
101 Civi
::$statics[__CLASS__
]['links'] = static::createReferenceColumns(__CLASS__
);
102 Civi
::$statics[__CLASS__
]['links'][] = new CRM_Core_Reference_Basic(self
::getTableName(), 'state_province_id', 'civicrm_state_province', 'id');
103 CRM_Core_DAO_AllCoreTables
::invoke(__CLASS__
, 'links_callback', Civi
::$statics[__CLASS__
]['links']);
105 return Civi
::$statics[__CLASS__
]['links'];
109 * Returns all the column names of this table
113 public static function &fields() {
114 if (!isset(Civi
::$statics[__CLASS__
]['fields'])) {
115 Civi
::$statics[__CLASS__
]['fields'] = [
118 'type' => CRM_Utils_Type
::T_INT
,
119 'title' => ts('County ID'),
120 'description' => ts('County ID'),
122 'where' => 'civicrm_county.id',
123 'table_name' => 'civicrm_county',
124 'entity' => 'County',
125 'bao' => 'CRM_Core_DAO_County',
131 'type' => CRM_Utils_Type
::T_STRING
,
132 'title' => ts('County'),
133 'description' => ts('Name of County'),
135 'size' => CRM_Utils_Type
::BIG
,
137 'where' => 'civicrm_county.name',
138 'headerPattern' => '/county/i',
139 'dataPattern' => '/[A-Z]{2}/',
141 'table_name' => 'civicrm_county',
142 'entity' => 'County',
143 'bao' => 'CRM_Core_DAO_County',
148 'name' => 'abbreviation',
149 'type' => CRM_Utils_Type
::T_STRING
,
150 'title' => ts('County Abbreviation'),
151 'description' => ts('2-4 Character Abbreviation of County'),
153 'size' => CRM_Utils_Type
::FOUR
,
154 'where' => 'civicrm_county.abbreviation',
155 'table_name' => 'civicrm_county',
156 'entity' => 'County',
157 'bao' => 'CRM_Core_DAO_County',
161 'state_province_id' => [
162 'name' => 'state_province_id',
163 'type' => CRM_Utils_Type
::T_INT
,
164 'title' => ts('State'),
165 'description' => ts('ID of State/Province that County belongs'),
167 'where' => 'civicrm_county.state_province_id',
168 'table_name' => 'civicrm_county',
169 'entity' => 'County',
170 'bao' => 'CRM_Core_DAO_County',
172 'FKClassName' => 'CRM_Core_DAO_StateProvince',
173 'pseudoconstant' => [
174 'table' => 'civicrm_state_province',
176 'labelColumn' => 'name',
181 'name' => 'is_active',
182 'type' => CRM_Utils_Type
::T_BOOLEAN
,
183 'title' => ts('County Is Active'),
184 'description' => ts('Is this County active?'),
185 'where' => 'civicrm_county.is_active',
187 'table_name' => 'civicrm_county',
188 'entity' => 'County',
189 'bao' => 'CRM_Core_DAO_County',
194 CRM_Core_DAO_AllCoreTables
::invoke(__CLASS__
, 'fields_callback', Civi
::$statics[__CLASS__
]['fields']);
196 return Civi
::$statics[__CLASS__
]['fields'];
200 * Return a mapping from field-name to the corresponding key (as used in fields()).
203 * Array(string $name => string $uniqueName).
205 public static function &fieldKeys() {
206 if (!isset(Civi
::$statics[__CLASS__
]['fieldKeys'])) {
207 Civi
::$statics[__CLASS__
]['fieldKeys'] = array_flip(CRM_Utils_Array
::collect('name', self
::fields()));
209 return Civi
::$statics[__CLASS__
]['fieldKeys'];
213 * Returns the names of this table
217 public static function getTableName() {
218 return self
::$_tableName;
222 * Returns if this table needs to be logged
226 public function getLog() {
231 * Returns the list of fields that can be imported
233 * @param bool $prefix
237 public static function &import($prefix = FALSE) {
238 $r = CRM_Core_DAO_AllCoreTables
::getImports(__CLASS__
, 'county', $prefix, []);
243 * Returns the list of fields that can be exported
245 * @param bool $prefix
249 public static function &export($prefix = FALSE) {
250 $r = CRM_Core_DAO_AllCoreTables
::getExports(__CLASS__
, 'county', $prefix, []);
255 * Returns the list of indices
257 * @param bool $localize
261 public static function indices($localize = TRUE) {
263 'UI_name_state_id' => [
264 'name' => 'UI_name_state_id',
267 1 => 'state_province_id',
269 'localizable' => FALSE,
271 'sig' => 'civicrm_county::1::name::state_province_id',
274 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables
::multilingualize(__CLASS__
, $indices) : $indices;