5 * @copyright CiviCRM LLC (c) 2004-2018
7 * Generated from xml/schema/CRM/Core/Country.xml
8 * DO NOT EDIT. Generated by CRM_Core_CodeGen
9 * (GenCodeChecksum:e01f7b6fdc1c22bcf6fbc125ea2d894a)
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 static $_tableName = 'civicrm_country';
25 * Should CiviCRM log any modifications to this table in the civicrm_log table.
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' => 'Country Id',
132 'table_name' => 'civicrm_country',
133 'entity' => 'Country',
134 'bao' => 'CRM_Core_BAO_Country',
139 'type' => CRM_Utils_Type
::T_STRING
,
140 'title' => ts('Country'),
141 'description' => 'Country Name',
143 'size' => CRM_Utils_Type
::BIG
,
145 'where' => 'civicrm_country.name',
146 'headerPattern' => '/country/i',
147 'dataPattern' => '/^[A-Z][a-z]+\.?(\s+[A-Z][a-z]+){0,3}$/',
149 'table_name' => 'civicrm_country',
150 'entity' => 'Country',
151 'bao' => 'CRM_Core_BAO_Country',
155 'name' => 'iso_code',
156 'type' => CRM_Utils_Type
::T_STRING
,
157 'title' => ts('Country ISO Code'),
158 'description' => 'ISO Code',
160 'size' => CRM_Utils_Type
::TWO
,
161 'table_name' => 'civicrm_country',
162 'entity' => 'Country',
163 'bao' => 'CRM_Core_BAO_Country',
167 'name' => 'country_code',
168 'type' => CRM_Utils_Type
::T_STRING
,
169 'title' => ts('Country Phone Prefix'),
170 'description' => 'National prefix to be used when dialing TO this country.',
172 'size' => CRM_Utils_Type
::FOUR
,
173 'table_name' => 'civicrm_country',
174 'entity' => 'Country',
175 'bao' => 'CRM_Core_BAO_Country',
178 'address_format_id' => [
179 'name' => 'address_format_id',
180 'type' => CRM_Utils_Type
::T_INT
,
181 'title' => ts('Address Format'),
182 'description' => 'Foreign key to civicrm_address_format.id.',
183 'table_name' => 'civicrm_country',
184 'entity' => 'Country',
185 'bao' => 'CRM_Core_BAO_Country',
187 'FKClassName' => 'CRM_Core_DAO_AddressFormat',
190 'name' => 'idd_prefix',
191 'type' => CRM_Utils_Type
::T_STRING
,
192 'title' => ts('Outgoing Phone Prefix'),
193 'description' => 'International direct dialing prefix from within the country TO another country',
195 'size' => CRM_Utils_Type
::FOUR
,
196 'table_name' => 'civicrm_country',
197 'entity' => 'Country',
198 'bao' => 'CRM_Core_BAO_Country',
202 'name' => 'ndd_prefix',
203 'type' => CRM_Utils_Type
::T_STRING
,
204 'title' => ts('Area Code'),
205 'description' => 'Access prefix to call within a country to a different area',
207 'size' => CRM_Utils_Type
::FOUR
,
208 'table_name' => 'civicrm_country',
209 'entity' => 'Country',
210 'bao' => 'CRM_Core_BAO_Country',
214 'name' => 'region_id',
215 'type' => CRM_Utils_Type
::T_INT
,
216 'title' => ts('Region'),
217 'description' => 'Foreign key to civicrm_worldregion.id.',
219 'table_name' => 'civicrm_country',
220 'entity' => 'Country',
221 'bao' => 'CRM_Core_BAO_Country',
223 'FKClassName' => 'CRM_Core_DAO_Worldregion',
225 'is_province_abbreviated' => [
226 'name' => 'is_province_abbreviated',
227 'type' => CRM_Utils_Type
::T_BOOLEAN
,
228 'title' => ts('Abbreviate Province?'),
229 'description' => 'Should state/province be displayed as abbreviation for contacts from this country?',
230 'table_name' => 'civicrm_country',
231 'entity' => 'Country',
232 'bao' => 'CRM_Core_BAO_Country',
236 CRM_Core_DAO_AllCoreTables
::invoke(__CLASS__
, 'fields_callback', Civi
::$statics[__CLASS__
]['fields']);
238 return Civi
::$statics[__CLASS__
]['fields'];
242 * Return a mapping from field-name to the corresponding key (as used in fields()).
245 * Array(string $name => string $uniqueName).
247 public static function &fieldKeys() {
248 if (!isset(Civi
::$statics[__CLASS__
]['fieldKeys'])) {
249 Civi
::$statics[__CLASS__
]['fieldKeys'] = array_flip(CRM_Utils_Array
::collect('name', self
::fields()));
251 return Civi
::$statics[__CLASS__
]['fieldKeys'];
255 * Returns the names of this table
259 public static function getTableName() {
260 return self
::$_tableName;
264 * Returns if this table needs to be logged
268 public function getLog() {
273 * Returns the list of fields that can be imported
275 * @param bool $prefix
279 public static function &import($prefix = FALSE) {
280 $r = CRM_Core_DAO_AllCoreTables
::getImports(__CLASS__
, 'country', $prefix, []);
285 * Returns the list of fields that can be exported
287 * @param bool $prefix
291 public static function &export($prefix = FALSE) {
292 $r = CRM_Core_DAO_AllCoreTables
::getExports(__CLASS__
, 'country', $prefix, []);
297 * Returns the list of indices
299 * @param bool $localize
303 public static function indices($localize = TRUE) {
305 'UI_name_iso_code' => [
306 'name' => 'UI_name_iso_code',
311 'localizable' => FALSE,
313 'sig' => 'civicrm_country::1::name::iso_code',
316 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables
::multilingualize(__CLASS__
, $indices) : $indices;