Skip to content

Latest commit

 

History

History
1605 lines (815 loc) · 36.4 KB

class.CountryCore.md

File metadata and controls

1605 lines (815 loc) · 36.4 KB

Class CountryCore

Contents

Properties

Methods

Properties

$_idZones

protected mixed $_idZones = array()

$active

public boolean $active = true

$call_prefix

public integer $call_prefix

$contains_states

public boolean $contains_states

$definition

public mixed $definition = array('table' => 'country', 'primary' => 'id_country', 'multilang' => true, 'fields' => array('id_zone' => array('type' => self::TYPE_INT, 'validate' => 'isUnsignedId', 'required' => true), 'id_currency' => array('type' => self::TYPE_INT, 'validate' => 'isUnsignedId'), 'call_prefix' => array('type' => self::TYPE_INT, 'validate' => 'isInt'), 'iso_code' => array('type' => self::TYPE_STRING, 'validate' => 'isLanguageIsoCode', 'required' => true, 'size' => 3), 'active' => array('type' => self::TYPE_BOOL, 'validate' => 'isBool'), 'contains_states' => array('type' => self::TYPE_BOOL, 'validate' => 'isBool', 'required' => true), 'need_identification_number' => array('type' => self::TYPE_BOOL, 'validate' => 'isBool', 'required' => true), 'need_zip_code' => array('type' => self::TYPE_BOOL, 'validate' => 'isBool'), 'zip_code_format' => array('type' => self::TYPE_STRING, 'validate' => 'isZipCodeFormat'), 'display_tax_label' => array('type' => self::TYPE_BOOL, 'validate' => 'isBool', 'required' => true), 'name' => array('type' => self::TYPE_STRING, 'lang' => true, 'validate' => 'isGenericName', 'required' => true, 'size' => 64)), 'associations' => array('zone' => array('type' => self::HAS_ONE), 'currency' => array('type' => self::HAS_ONE)))

$display_tax_label

public boolean $display_tax_label = true

$id

public mixed $id

$id_currency

public integer $id_currency

$id_zone

public integer $id_zone

$iso_code

public string $iso_code

$name

public string $name

$need_identification_number

public boolean $need_identification_number

$need_zip_code

public boolean $need_zip_code

$webserviceParameters

protected mixed $webserviceParameters = array('objectsNodeName' => 'countries', 'fields' => array('id_zone' => array('xlink_resource' => 'zones'), 'id_currency' => array('xlink_resource' => 'currencies')))

$zip_code_format

public string $zip_code_format

$def

protected array $def

$fieldsRequired

protected mixed $fieldsRequired = array()

$fieldsRequiredDatabase

protected mixed $fieldsRequiredDatabase = null

$fieldsRequiredLang

protected mixed $fieldsRequiredLang = array()

$fieldsSize

protected mixed $fieldsSize = array()

$fieldsSizeLang

protected mixed $fieldsSizeLang = array()

$fieldsValidate

protected mixed $fieldsValidate = array()

$fieldsValidateLang

protected mixed $fieldsValidateLang = array()

$id_lang

protected integer $id_lang = null

$id_shop

protected mixed $id_shop = null

$identifier

protected mixed $identifier

$image_dir

protected string $image_dir = null

$image_format

protected string $image_format = 'jpg'

$table

protected mixed $table

$tables

protected mixed $tables = array()

Methods

__construct

mixed ObjectModelCore::__construct(integer $id, integer $id_lang, integer $id_shop)

Build object

Arguments

  • $id integer - Existing object id in order to load object (optional)
  • $id_lang integer - Required if object is multilingual (optional)
  • $id_shop integer - ID shop for objects with multishop on langs

add

boolean ObjectModelCore::add(boolean $autodate, boolean $null_values)

Add current object to database

Arguments

  • $autodate boolean
  • $null_values boolean

addFieldsRequiredDatabase

mixed ObjectModelCore::addFieldsRequiredDatabase($fields)

Arguments

  • $fields mixed

affectZoneToSelection

boolean CountryCore::affectZoneToSelection($ids_countries, $id_zone)

Arguments

  • $ids_countries mixed
  • $id_zone mixed

associateTo

boolean ObjectModelCore::associateTo(integer|array $id_shops, string $type)

This function associate an item to its context

Arguments

  • $id_shops integer|array
  • $type string

clearCache

mixed ObjectModelCore::clearCache($all)

Arguments

  • $all mixed

containsStates

mixed CountryCore::containsStates($id_country)

Arguments

  • $id_country mixed

delete

mixed CountryCore::delete()

deleteImage

boolean ObjectModelCore::deleteImage()

Delete images associated with the object

deleteSelection

boolean ObjectModelCore::deleteSelection(array $selection)

Delete several objects from database

Arguments

  • $selection array

displayFieldName

mixed ObjectModelCore::displayFieldName($field, $class, $htmlentities, \Context $context)

Arguments

  • $field mixed
  • $class mixed
  • $htmlentities mixed
  • $context Context

duplicateShops

mixed ObjectModelCore::duplicateShops($id)

Arguments

  • $id mixed

existsInDatabase

boolean ObjectModelCore::existsInDatabase(integer $id_entity, string $table)

Specify if an ObjectModel is already in database

Arguments

  • $id_entity integer
  • $table string

formatFields

array ObjectModelCore::formatFields(integer $id_lang)

Arguments

  • $id_lang integer - If this parameter is given, only take lang fields

formatValue

mixed ObjectModelCore::formatValue(mixed $value, integer $type, $with_quotes)

Format a data

Arguments

  • $value mixed
  • $type integer
  • $with_quotes mixed

getByIso

integer CountryCore::getByIso(string $iso_code)

Get a country ID with its iso code

Arguments

  • $iso_code string - Country iso code

getCountries

array CountryCore::getCountries(integer $id_lang, boolean $active, $contain_states, \Shop $shop)

Return available countries

Arguments

  • $id_lang integer - Language ID
  • $active boolean - return only active coutries
  • $contain_states mixed
  • $shop Shop

getCountriesByZoneId

mixed CountryCore::getCountriesByZoneId($id_zone, $id_lang, \Shop $shop)

Arguments

  • $id_zone mixed
  • $id_lang mixed
  • $shop Shop

getDefaultCountryId

integer CountryCore::getDefaultCountryId()

Returns the default country Id

getDefinition

array ObjectModelCore::getDefinition(string $class, string $field)

Get object definition

Arguments

  • $class string - Name of object
  • $field string - Name of field if we want the definition of one field only

getFieldByLang

mixed ObjectModelCore::getFieldByLang($field_name, null $id_lang)

Return the field value for the specified language if the field is multilang, else the field value.

Arguments

  • $field_name mixed
  • $id_lang null

getFields

array ObjectModelCore::getFields()

Prepare fields for ObjectModel class (add, update) All fields are verified (pSQL, intval.

..)

getFieldsLang

array ObjectModelCore::getFieldsLang()

Prepare multilang fields

getFieldsRequiredDatabase

mixed ObjectModelCore::getFieldsRequiredDatabase($all)

Arguments

  • $all mixed

getIdByName

\intval CountryCore::getIdByName(integer $id_lang, string $country)

Get a country id with its name

Arguments

  • $id_lang integer - Language ID
  • $country string - Country Name

getIdZone

mixed CountryCore::getIdZone($id_country)

Arguments

  • $id_country mixed

getIsoById

string CountryCore::getIsoById(integer $id_country)

Get a country iso with its ID

Arguments

  • $id_country integer - Country ID

getNameById

string CountryCore::getNameById(integer $id_lang, integer $id_country)

Get a country name with its ID

Arguments

  • $id_lang integer - Language ID
  • $id_country integer - Country ID

getNeedZipCode

mixed CountryCore::getNeedZipCode($id_country)

Arguments

  • $id_country mixed

getTranslationsFields

mixed ObjectModelCore::getTranslationsFields($fields_array)

Arguments

  • $fields_array mixed

getValidationRules

array ObjectModelCore::getValidationRules(string $class)

Returns object validation rules (fields validity)

Arguments

  • $class string - Child class name for static use (optional)

getWebserviceObjectList

mixed ObjectModelCore::getWebserviceObjectList($sql_join, $sql_filter, $sql_sort, $sql_limit)

Arguments

  • $sql_join mixed
  • $sql_filter mixed
  • $sql_sort mixed
  • $sql_limit mixed

getWebserviceParameters

mixed ObjectModelCore::getWebserviceParameters($ws_params_attribute_name)

Arguments

  • $ws_params_attribute_name mixed

getZipCodeFormat

mixed CountryCore::getZipCodeFormat($id_country)

Arguments

  • $id_country mixed

hydrate

mixed ObjectModelCore::hydrate(array $data, integer $id_lang)

Fill an object with given data. Data must be an array with this syntax: array(objProperty => value, objProperty2 => value, etc.)

Arguments

  • $data array
  • $id_lang integer

hydrateCollection

array ObjectModelCore::hydrateCollection(string $class, array $datas, integer $id_lang)

Fill (hydrate) a list of objects in order to get a collection of these objects

Arguments

  • $class string - Class of objects to hydrate
  • $datas array - List of data (multi-dimensional array)
  • $id_lang integer

isAssociatedToGroupShop

boolean ObjectModelCore::isAssociatedToGroupShop(integer $id_group_shop)

Check if current object is associated to a group shop

Arguments

  • $id_group_shop integer

isAssociatedToShop

boolean ObjectModelCore::isAssociatedToShop(integer $id_shop)

Check if current object is associated to a shop

Arguments

  • $id_shop integer

isCurrentlyUsed

boolean ObjectModelCore::isCurrentlyUsed(string $table, boolean $has_active_column)

This method is allow to know if a entity is currently used

Arguments

  • $table string - name of table linked to entity
  • $has_active_column boolean - true if the table has an active column

isLangMultishop

mixed ObjectModelCore::isLangMultishop()

isNeedDni

mixed CountryCore::isNeedDni()

isNeedDniByCountryId

mixed CountryCore::isNeedDniByCountryId($id_country)

Arguments

  • $id_country mixed

makeTranslationFields

mixed ObjectModelCore::makeTranslationFields($fields, $fields_array, $id_language)

Arguments

  • $fields mixed
  • $fields_array mixed
  • $id_language mixed

save

boolean ObjectModelCore::save(boolean $null_values, boolean $autodate)

Save current object to database (add or update)

Arguments

  • $null_values boolean
  • $autodate boolean

setDefinitionRetrocompatibility

mixed ObjectModelCore::setDefinitionRetrocompatibility()

Retrocompatibility for classes without $definition static Remove this in 1.6 !

toggleStatus

boolean ObjectModelCore::toggleStatus()

Toggle object status in database

update

boolean ObjectModelCore::update(boolean $null_values)

Update current object to database

Arguments

  • $null_values boolean

validateControler

mixed ObjectModelCore::validateControler($htmlentities)

TODO: refactor rename all calls to this to validateController

Arguments

  • $htmlentities mixed

validateController

mixed ObjectModelCore::validateController($htmlentities)

Arguments

  • $htmlentities mixed

validateField

boolean|string ObjectModelCore::validateField(string $field, mixed $value, integer $id_lang)

Validate a single field

Arguments

  • $field string - Field name
  • $value mixed - Field value
  • $id_lang integer

validateFields

boolean|string ObjectModelCore::validateFields(boolean $die, boolean $error_return)

Check for fields validity before database interaction

Arguments

  • $die boolean
  • $error_return boolean

validateFieldsLang

boolean|string ObjectModelCore::validateFieldsLang(boolean $die, boolean $error_return)

Check for multilingual fields validity before database interaction

Arguments

  • $die boolean
  • $error_return boolean