Currency Class Reference

Inheritance diagram for Currency:
RedBeanModel BeanModel ObservableComponent

Public Member Functions

 __toString ()
 isUniqueAttributeValue ($attributeName, $value)
 save ($runValidation=true, array $attributeNames=null)

Static Public Member Functions

static getById ($id, $modelClassName=null)
static getByCode ($code)
static getAll ($orderBy=null, $sortDescending=false, $modelClassName=null, $buildFirstCurrency=true)
static makeBaseCurrency ()
static canSaveMetadata ()
static getModuleClassName ()
static getDefaultMetadata ()
static isTypeDeletable ()
static getCachedCurrencyByCode ($code)
static setCachedCurrency (Currency $currency)
static getAllCachedCurrencies ()
static setAllCachedCurrencies ($currencies)
static resetCaches ()

Static Protected Member Functions

static getLabel ($language=null)
static translatedAttributeLabels ($language)

Protected Attributes

 $isSavableFromRelation = false

Detailed Description

Model for storing system supported currencies.

Definition at line 40 of file Currency.php.

Member Function Documentation

static getById ( id,
modelClassName = null 
) [static]

Override of getById in RedBeanModel in order to cache the result. Currency rarely changes, so caching the currency on this method provides a performance boost.

integer $id
string $modelClassName

Reimplemented from RedBeanModel.

Definition at line 73 of file Currency.php.

static getByCode ( code  )  [static]

Gets a currency by code.

$code String Code.
A model of type currency

Definition at line 90 of file Currency.php.

static getAll ( orderBy = null,
sortDescending = false,
modelClassName = null,
buildFirstCurrency = true 
) [static]

Override to check if no results are returned and load the baseCurrency as the first currency in that scenario.

Definition at line 107 of file Currency.php.

__toString (  ) 

Returns the displayable string for the class. Should be overridden in any model that can provide a meaningful string representation of itself.

A string.

Reimplemented from RedBeanModel.

Definition at line 132 of file Currency.php.

static canSaveMetadata (  )  [static]

By default models cannot save their metadata, allowing them to be loaded quickly because the loading of of metadata can be avoided as much as possible. To make a model able to save its metadata override this method to return true. PUT it before the getDefaultMetadata in the derived class.

Reimplemented from RedBeanModel.

Definition at line 141 of file Currency.php.

static getModuleClassName (  )  [static]

Reimplemented from RedBeanModel.

Definition at line 149 of file Currency.php.

static getLabel ( language = null  )  [static, protected]

Returns the display name for the model class. Defaults to the module label. Override if the model label is not the module label. Make sure to return a translated label. Also provides fall back in moduleClassName is null.

null | string $language
dynamic label name based on module.

Reimplemented from RedBeanModel.

Definition at line 161 of file Currency.php.

static getDefaultMetadata (  )  [static]

Returns the default meta data for the class. It must be appended to the meta data from the parent model, if any.

Reimplemented from RedBeanModel.

Definition at line 166 of file Currency.php.

static isTypeDeletable (  )  [static]

To be overriden on intermediate derived classes to return false so that deletes are not done on intermediate classes because the object relational mapping will not clean up properly. For example if User is a Person, and Person is a RedBeanModel delete should be called only on User, not on Person. So User must override isDeletable to return false.

Reimplemented from RedBeanModel.

Definition at line 193 of file Currency.php.

static getCachedCurrencyByCode ( code  )  [static]

Attempt to get the cached currency model by providing a currency code.

string $code
Currency model if found, otherwise returns null

Definition at line 203 of file Currency.php.

static setCachedCurrency ( Currency currency  )  [static]

Given a currency model, set the currency model as cached.

unknown_type $currency

Definition at line 218 of file Currency.php.

isUniqueAttributeValue ( attributeName,

Override to provide a performance boost by relying on cached row data regarding uniqueness of a currency. This was required since the currency validator was running anytime a currencyValue is validated. Yet we don't need to check the validation of currency all the time since currency does not change often and not from a related model. (non-PHPdoc)

See also:

Reimplemented from RedBeanModel.

Definition at line 233 of file Currency.php.

save ( runValidation = true,
array $  attributeNames = null 

Override to resetCache after a currency is saved. (non-PHPdoc)

See also:

Reimplemented from RedBeanModel.

Definition at line 259 of file Currency.php.

static getAllCachedCurrencies (  )  [static]

Attempt to get the cached list of currency models.

array of Currency models if found, otherwise returns null

Definition at line 270 of file Currency.php.

static setAllCachedCurrencies ( currencies  )  [static]

Set a list of cached currency models


Definition at line 283 of file Currency.php.

static resetCaches (  )  [static]

The currency cache is a php only cache. This resets the cache. Useful during testing when the php is still running between requests and tests.

Definition at line 292 of file Currency.php.

The documentation for this class was generated from the following file:
 All Data Structures Functions Variables
Generated on Mon Jan 20 07:10:50 2020