5 * @copyright CiviCRM LLC (c) 2004-2019
7 * Generated from xml/schema/CRM/Core/Country.xml
8 * DO NOT EDIT. Generated by CRM_Core_CodeGen
9 * (GenCodeChecksum:7479471ae701d767241aea412fae5024)
13 * Database access object for the Country entity.
15 class CRM_Core_DAO_Country
extends CRM_Core_DAO
{
18 * Static instance to hold the table name.
22 public static $_tableName = 'civicrm_country';
25 * Should CiviCRM log any modifications to this table in the civicrm_log table.
29 public static $_log = FALSE;
53 * National prefix to be used when dialing TO this country.
60 * Foreign key to civicrm_address_format.id.
64 public $address_format_id;
67 * International direct dialing prefix from within the country TO another country
74 * Access prefix to call within a country to a different area
81 * Foreign key to civicrm_worldregion.id.
88 * Should state/province be displayed as abbreviation for contacts from this country?
92 public $is_province_abbreviated;
97 public function __construct() {
98 $this->__table
= 'civicrm_country';
99 parent
::__construct();
103 * Returns foreign keys and entity references.
106 * [CRM_Core_Reference_Interface]
108 public static function getReferenceColumns() {
109 if (!isset(Civi
::$statics[__CLASS__
]['links'])) {
110 Civi
::$statics[__CLASS__
]['links'] = static::createReferenceColumns(__CLASS__
);
111 Civi
::$statics[__CLASS__
]['links'][] = new CRM_Core_Reference_Basic(self
::getTableName(), 'address_format_id', 'civicrm_address_format', 'id');
112 Civi
::$statics[__CLASS__
]['links'][] = new CRM_Core_Reference_Basic(self
::getTableName(), 'region_id', 'civicrm_worldregion', '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('Country ID'),
130 'description' => ts('Country Id'),
132 'where' => 'civicrm_country.id',
133 'table_name' => 'civicrm_country',
134 'entity' => 'Country',
135 'bao' => 'CRM_Core_BAO_Country',
140 'type' => CRM_Utils_Type
::T_STRING
,
141 'title' => ts('Country'),
142 'description' => ts('Country Name'),
144 'size' => CRM_Utils_Type
::BIG
,
146 'where' => 'civicrm_country.name',
147 'headerPattern' => '/country/i',
148 'dataPattern' => '/^[A-Z][a-z]+\.?(\s+[A-Z][a-z]+){0,3}$/',
150 'table_name' => 'civicrm_country',
151 'entity' => 'Country',
152 'bao' => 'CRM_Core_BAO_Country',
156 'name' => 'iso_code',
157 'type' => CRM_Utils_Type
::T_STRING
,
158 'title' => ts('Country ISO Code'),
159 'description' => ts('ISO Code'),
161 'size' => CRM_Utils_Type
::TWO
,
162 'where' => 'civicrm_country.iso_code',
163 'table_name' => 'civicrm_country',
164 'entity' => 'Country',
165 'bao' => 'CRM_Core_BAO_Country',
169 'name' => 'country_code',
170 'type' => CRM_Utils_Type
::T_STRING
,
171 'title' => ts('Country Phone Prefix'),
172 'description' => ts('National prefix to be used when dialing TO this country.'),
174 'size' => CRM_Utils_Type
::FOUR
,
175 'where' => 'civicrm_country.country_code',
176 'table_name' => 'civicrm_country',
177 'entity' => 'Country',
178 'bao' => 'CRM_Core_BAO_Country',
181 'address_format_id' => [
182 'name' => 'address_format_id',
183 'type' => CRM_Utils_Type
::T_INT
,
184 'title' => ts('Address Format'),
185 'description' => ts('Foreign key to civicrm_address_format.id.'),
186 'where' => 'civicrm_country.address_format_id',
187 'table_name' => 'civicrm_country',
188 'entity' => 'Country',
189 'bao' => 'CRM_Core_BAO_Country',
191 'FKClassName' => 'CRM_Core_DAO_AddressFormat',
194 'name' => 'idd_prefix',
195 'type' => CRM_Utils_Type
::T_STRING
,
196 'title' => ts('Outgoing Phone Prefix'),
197 'description' => ts('International direct dialing prefix from within the country TO another country'),
199 'size' => CRM_Utils_Type
::FOUR
,
200 'where' => 'civicrm_country.idd_prefix',
201 'table_name' => 'civicrm_country',
202 'entity' => 'Country',
203 'bao' => 'CRM_Core_BAO_Country',
207 'name' => 'ndd_prefix',
208 'type' => CRM_Utils_Type
::T_STRING
,
209 'title' => ts('Area Code'),
210 'description' => ts('Access prefix to call within a country to a different area'),
212 'size' => CRM_Utils_Type
::FOUR
,
213 'where' => 'civicrm_country.ndd_prefix',
214 'table_name' => 'civicrm_country',
215 'entity' => 'Country',
216 'bao' => 'CRM_Core_BAO_Country',
220 'name' => 'region_id',
221 'type' => CRM_Utils_Type
::T_INT
,
222 'title' => ts('World Region ID'),
223 'description' => ts('Foreign key to civicrm_worldregion.id.'),
225 'where' => 'civicrm_country.region_id',
226 'table_name' => 'civicrm_country',
227 'entity' => 'Country',
228 'bao' => 'CRM_Core_BAO_Country',
230 'localize_context' => 'country',
231 'FKClassName' => 'CRM_Core_DAO_Worldregion',
232 'pseudoconstant' => [
233 'table' => 'civicrm_worldregion',
235 'labelColumn' => 'name',
238 'is_province_abbreviated' => [
239 'name' => 'is_province_abbreviated',
240 'type' => CRM_Utils_Type
::T_BOOLEAN
,
241 'title' => ts('Abbreviate Province?'),
242 'description' => ts('Should state/province be displayed as abbreviation for contacts from this country?'),
243 'where' => 'civicrm_country.is_province_abbreviated',
245 'table_name' => 'civicrm_country',
246 'entity' => 'Country',
247 'bao' => 'CRM_Core_BAO_Country',
251 CRM_Core_DAO_AllCoreTables
::invoke(__CLASS__
, 'fields_callback', Civi
::$statics[__CLASS__
]['fields']);
253 return Civi
::$statics[__CLASS__
]['fields'];
257 * Return a mapping from field-name to the corresponding key (as used in fields()).
260 * Array(string $name => string $uniqueName).
262 public static function &fieldKeys() {
263 if (!isset(Civi
::$statics[__CLASS__
]['fieldKeys'])) {
264 Civi
::$statics[__CLASS__
]['fieldKeys'] = array_flip(CRM_Utils_Array
::collect('name', self
::fields()));
266 return Civi
::$statics[__CLASS__
]['fieldKeys'];
270 * Returns the names of this table
274 public static function getTableName() {
275 return self
::$_tableName;
279 * Returns if this table needs to be logged
283 public function getLog() {
288 * Returns the list of fields that can be imported
290 * @param bool $prefix
294 public static function &import($prefix = FALSE) {
295 $r = CRM_Core_DAO_AllCoreTables
::getImports(__CLASS__
, 'country', $prefix, []);
300 * Returns the list of fields that can be exported
302 * @param bool $prefix
306 public static function &export($prefix = FALSE) {
307 $r = CRM_Core_DAO_AllCoreTables
::getExports(__CLASS__
, 'country', $prefix, []);
312 * Returns the list of indices
314 * @param bool $localize
318 public static function indices($localize = TRUE) {
320 'UI_name_iso_code' => [
321 'name' => 'UI_name_iso_code',
326 'localizable' => FALSE,
328 'sig' => 'civicrm_country::1::name::iso_code',
331 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables
::multilingualize(__CLASS__
, $indices) : $indices;