Blesta Source Documentation

Countries extends AppModel

Countries adhere to ISO 3166-1 and contain English and native country name (when differing from English)

Table of Contents

Methods

__construct() Initialize Countries
add() Add a country
delete() Delete a country by the ISO 3166-1 alpha2 or alpha3 code
edit() Edit a country by the ISO 3166-1 alpha2 code
get() Get a specific country based ISO 3166-1 alpha2 or alpha3
getList() List all countries
validateAlpha3InUse() Validates that the given alpha3 character code for a country is already in use
getRules() Returns the rules for adding/editing countries
Methods

__construct()

Initialize Countries

public __construct() : mixed

add()

Add a country

public add(array<string|int, mixed> $vars) : mixed
Parameters
$vars : array<string|int, mixed>

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)

delete()

Delete a country by the ISO 3166-1 alpha2 or alpha3 code

public delete(string $code) : mixed
Parameters
$code : string

The ISO 3166-1 alpha2 or alpha3 country code to delete

edit()

Edit a country by the ISO 3166-1 alpha2 code

public edit(string $alpha2, array<string|int, mixed> $vars) : mixed
Parameters
$alpha2 : string

The ISO 3166-1 alpha2 country code

$vars : array<string|int, mixed>

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)

get()

Get a specific country based ISO 3166-1 alpha2 or alpha3

public get(string $code) : mixed
Parameters
$code : string

The ISO 3166-1 alpha2 or alpha3 country code to search on

Return values
mixed

A stdClass country object, false if no record found

getList()

List all countries

public getList([string $sort_by = 'name' ][, string $order = 'asc' ]) : mixed
Parameters
$sort_by : string = 'name'

The field to sort the list by

$order : string = 'asc'

The order to sort (acs, desc)

Return values
mixed

An array of stdClass country objects, false if no records found

validateAlpha3InUse()

Validates that the given alpha3 character code for a country is already in use

public validateAlpha3InUse(string $alpha3, string $alpha2) : bool
Parameters
$alpha3 : string

The ISO 3166-1 alpha3 country code to check for

$alpha2 : string

The ISO 3166-1 alpha2 country code to ignore if it happens to match $alpha3

Return values
bool

True if the alpha3 country code is already taken

getRules()

Returns the rules for adding/editing countries

private getRules(array<string|int, mixed> $vars) : array<string|int, mixed>
Parameters
$vars : array<string|int, mixed>

The key/value pairs used for language replacement

Return values
array<string|int, mixed>

The rules

Tags
subpackage

app.models

copyright

Copyright (c) 2010, Phillips Data, Inc.

license

http://www.blesta.com/license/ The Blesta License Agreement

link

Blesta


        
On this page

Search results