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:f54f7ff28a6ecde09252698c389db154)
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',
135 'type' => CRM_Utils_Type
::T_STRING
,
136 'title' => ts('County'),
137 'description' => ts('Name of County'),
139 'size' => CRM_Utils_Type
::BIG
,
141 'where' => 'civicrm_county.name',
142 'headerPattern' => '/county/i',
143 'dataPattern' => '/[A-Z]{2}/',
145 'table_name' => 'civicrm_county',
146 'entity' => 'County',
147 'bao' => 'CRM_Core_DAO_County',
152 'name' => 'abbreviation',
153 'type' => CRM_Utils_Type
::T_STRING
,
154 'title' => ts('County Abbreviation'),
155 'description' => ts('2-4 Character Abbreviation of County'),
157 'size' => CRM_Utils_Type
::FOUR
,
158 'where' => 'civicrm_county.abbreviation',
159 'table_name' => 'civicrm_county',
160 'entity' => 'County',
161 'bao' => 'CRM_Core_DAO_County',
165 'state_province_id' => [
166 'name' => 'state_province_id',
167 'type' => CRM_Utils_Type
::T_INT
,
168 'title' => ts('State ID'),
169 'description' => ts('ID of State/Province that County belongs'),
171 'where' => 'civicrm_county.state_province_id',
172 'table_name' => 'civicrm_county',
173 'entity' => 'County',
174 'bao' => 'CRM_Core_DAO_County',
176 'FKClassName' => 'CRM_Core_DAO_StateProvince',
178 'label' => ts("State"),
180 'pseudoconstant' => [
181 'table' => 'civicrm_state_province',
183 'labelColumn' => 'name',
184 'abbrColumn' => 'abbreviation',
189 'name' => 'is_active',
190 'type' => CRM_Utils_Type
::T_BOOLEAN
,
191 'title' => ts('County Is Active'),
192 'description' => ts('Is this County active?'),
193 'where' => 'civicrm_county.is_active',
195 'table_name' => 'civicrm_county',
196 'entity' => 'County',
197 'bao' => 'CRM_Core_DAO_County',
202 CRM_Core_DAO_AllCoreTables
::invoke(__CLASS__
, 'fields_callback', Civi
::$statics[__CLASS__
]['fields']);
204 return Civi
::$statics[__CLASS__
]['fields'];
208 * Return a mapping from field-name to the corresponding key (as used in fields()).
211 * Array(string $name => string $uniqueName).
213 public static function &fieldKeys() {
214 if (!isset(Civi
::$statics[__CLASS__
]['fieldKeys'])) {
215 Civi
::$statics[__CLASS__
]['fieldKeys'] = array_flip(CRM_Utils_Array
::collect('name', self
::fields()));
217 return Civi
::$statics[__CLASS__
]['fieldKeys'];
221 * Returns the names of this table
225 public static function getTableName() {
226 return self
::$_tableName;
230 * Returns if this table needs to be logged
234 public function getLog() {
239 * Returns the list of fields that can be imported
241 * @param bool $prefix
245 public static function &import($prefix = FALSE) {
246 $r = CRM_Core_DAO_AllCoreTables
::getImports(__CLASS__
, 'county', $prefix, []);
251 * Returns the list of fields that can be exported
253 * @param bool $prefix
257 public static function &export($prefix = FALSE) {
258 $r = CRM_Core_DAO_AllCoreTables
::getExports(__CLASS__
, 'county', $prefix, []);
263 * Returns the list of indices
265 * @param bool $localize
269 public static function indices($localize = TRUE) {
271 'UI_name_state_id' => [
272 'name' => 'UI_name_state_id',
275 1 => 'state_province_id',
277 'localizable' => FALSE,
279 'sig' => 'civicrm_county::1::name::state_province_id',
282 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables
::multilingualize(__CLASS__
, $indices) : $indices;