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:3b5b06caf78948fe6bbbafe831c2aa96)
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;
43 * @var int|string|null
44 * (SQL type: int unsigned)
45 * Note that values will be retrieved from the database as a string.
53 * (SQL type: varchar(64))
54 * Note that values will be retrieved from the database as a string.
59 * 2-4 Character Abbreviation of County
62 * (SQL type: varchar(4))
63 * Note that values will be retrieved from the database as a string.
68 * ID of State/Province that County belongs
71 * (SQL type: int unsigned)
72 * Note that values will be retrieved from the database as a string.
74 public $state_province_id;
77 * Is this County active?
81 * Note that values will be retrieved from the database as a string.
88 public function __construct() {
89 $this->__table
= 'civicrm_county';
90 parent
::__construct();
94 * Returns localized title of this entity.
97 * Whether to return the plural version of the title.
99 public static function getEntityTitle($plural = FALSE) {
100 return $plural ?
ts('Counties') : ts('County');
104 * Returns foreign keys and entity references.
107 * [CRM_Core_Reference_Interface]
109 public static function getReferenceColumns() {
110 if (!isset(Civi
::$statics[__CLASS__
]['links'])) {
111 Civi
::$statics[__CLASS__
]['links'] = static::createReferenceColumns(__CLASS__
);
112 Civi
::$statics[__CLASS__
]['links'][] = new CRM_Core_Reference_Basic(self
::getTableName(), 'state_province_id', 'civicrm_state_province', 'id');
113 CRM_Core_DAO_AllCoreTables
::invoke(__CLASS__
, 'links_callback', Civi
::$statics[__CLASS__
]['links']);
115 return Civi
::$statics[__CLASS__
]['links'];
119 * Returns all the column names of this table
123 public static function &fields() {
124 if (!isset(Civi
::$statics[__CLASS__
]['fields'])) {
125 Civi
::$statics[__CLASS__
]['fields'] = [
128 'type' => CRM_Utils_Type
::T_INT
,
129 'title' => ts('County ID'),
130 'description' => ts('County ID'),
132 'where' => 'civicrm_county.id',
133 'table_name' => 'civicrm_county',
134 'entity' => 'County',
135 'bao' => 'CRM_Core_DAO_County',
145 'type' => CRM_Utils_Type
::T_STRING
,
146 'title' => ts('County'),
147 'description' => ts('Name of County'),
149 'size' => CRM_Utils_Type
::BIG
,
151 'where' => 'civicrm_county.name',
152 'headerPattern' => '/county/i',
153 'dataPattern' => '/[A-Z]{2}/',
155 'table_name' => 'civicrm_county',
156 'entity' => 'County',
157 'bao' => 'CRM_Core_DAO_County',
162 'name' => 'abbreviation',
163 'type' => CRM_Utils_Type
::T_STRING
,
164 'title' => ts('County Abbreviation'),
165 'description' => ts('2-4 Character Abbreviation of County'),
167 'size' => CRM_Utils_Type
::FOUR
,
168 'where' => 'civicrm_county.abbreviation',
169 'table_name' => 'civicrm_county',
170 'entity' => 'County',
171 'bao' => 'CRM_Core_DAO_County',
175 'state_province_id' => [
176 'name' => 'state_province_id',
177 'type' => CRM_Utils_Type
::T_INT
,
178 'title' => ts('State ID'),
179 'description' => ts('ID of State/Province that County belongs'),
181 'where' => 'civicrm_county.state_province_id',
182 'table_name' => 'civicrm_county',
183 'entity' => 'County',
184 'bao' => 'CRM_Core_DAO_County',
186 'FKClassName' => 'CRM_Core_DAO_StateProvince',
188 'label' => ts("State"),
190 'pseudoconstant' => [
191 'table' => 'civicrm_state_province',
193 'labelColumn' => 'name',
194 'abbrColumn' => 'abbreviation',
199 'name' => 'is_active',
200 'type' => CRM_Utils_Type
::T_BOOLEAN
,
201 'title' => ts('County Is Active'),
202 'description' => ts('Is this County active?'),
204 'where' => 'civicrm_county.is_active',
206 'table_name' => 'civicrm_county',
207 'entity' => 'County',
208 'bao' => 'CRM_Core_DAO_County',
213 CRM_Core_DAO_AllCoreTables
::invoke(__CLASS__
, 'fields_callback', Civi
::$statics[__CLASS__
]['fields']);
215 return Civi
::$statics[__CLASS__
]['fields'];
219 * Return a mapping from field-name to the corresponding key (as used in fields()).
222 * Array(string $name => string $uniqueName).
224 public static function &fieldKeys() {
225 if (!isset(Civi
::$statics[__CLASS__
]['fieldKeys'])) {
226 Civi
::$statics[__CLASS__
]['fieldKeys'] = array_flip(CRM_Utils_Array
::collect('name', self
::fields()));
228 return Civi
::$statics[__CLASS__
]['fieldKeys'];
232 * Returns the names of this table
236 public static function getTableName() {
237 return self
::$_tableName;
241 * Returns if this table needs to be logged
245 public function getLog() {
250 * Returns the list of fields that can be imported
252 * @param bool $prefix
256 public static function &import($prefix = FALSE) {
257 $r = CRM_Core_DAO_AllCoreTables
::getImports(__CLASS__
, 'county', $prefix, []);
262 * Returns the list of fields that can be exported
264 * @param bool $prefix
268 public static function &export($prefix = FALSE) {
269 $r = CRM_Core_DAO_AllCoreTables
::getExports(__CLASS__
, 'county', $prefix, []);
274 * Returns the list of indices
276 * @param bool $localize
280 public static function indices($localize = TRUE) {
282 'UI_name_state_id' => [
283 'name' => 'UI_name_state_id',
286 1 => 'state_province_id',
288 'localizable' => FALSE,
290 'sig' => 'civicrm_county::1::name::state_province_id',
293 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables
::multilingualize(__CLASS__
, $indices) : $indices;