Class Countries
Countries adhere to ISO 3166-1 and contain English and native country name
(when differing from English)
-
Model
-
AppModel
uses
Blesta\Core\Util\Common\Traits\Container
-
Countries
Methods summary
public
|
#
__construct( )
Initialize Countries
Overrides
|
public
mixed
|
#
getList( string $sort_by = 'name', string $order = 'asc' )
List all countries
Parameters
- $sort_by
- The field to sort the list by
- $order
- The order to sort (acs, desc)
Returns
mixed An array of stdClass country objects, false if no records found
|
public
mixed
|
#
get( string $code )
Get a specific country based ISO 3166-1 alpha2 or alpha3
Get a specific country based ISO 3166-1 alpha2 or alpha3
Parameters
- $code
- The ISO 3166-1 alpha2 or alpha3 country code to search on
Returns
mixed A stdClass country object, false if no record found
|
public
|
#
add( array $vars )
Add a country
Parameters
- $vars
An array of variable info, including:
- alpha2 The ISO 3166-1 alpha2 country code
- alpha3 The ISO 3166-1 alpha3 country code
- name The english country name
- alt_name The native language country name (optional)
|
public
|
#
edit( string $alpha2, array $vars )
Edit a country by the ISO 3166-1 alpha2 code
Edit a country by the ISO 3166-1 alpha2 code
Parameters
- $alpha2
- The ISO 3166-1 alpha2 country code
- $vars
An array of variable info, including:
- alpha3 The ISO 3166-1 alpha3 country code
- name The english country name
- alt_name The native language country name (optional)
|
public
|
#
delete( string $code )
Delete a country by the ISO 3166-1 alpha2 or alpha3 code
Delete a country by the ISO 3166-1 alpha2 or alpha3 code
Parameters
- $code
- The ISO 3166-1 alpha2 or alpha3 country code to delete
|
public
boolean
|
#
validateAlpha3InUse( string $alpha3, string $alpha2 )
Validates that the given alpha3 character code for a country is already in use
Validates that the given alpha3 character code for a country is already in use
Parameters
- $alpha3
- The ISO 3166-1 alpha3 country code to check for
- $alpha2
- The ISO 3166-1 alpha2 country code to ignore if it happens to match $alpha3
Returns
boolean True if the alpha3 country code is already taken
|
Methods inherited from AppModel
_(),
boolToInt(),
currencyToDecimal(),
dateToUtc(),
errors(),
getPerPage(),
ifSet(),
loadCrypto(),
setDefaultIfEmpty(),
setPerPage(),
setRulesIfSet(),
strToBool(),
systemDecrypt(),
systemEncrypt(),
systemHash(),
truncateDecimal(),
validateExists(),
validateStateCountry()
|