class CurrencyManager implements CurrencyManagerInterface, BasicEntityManagerInterface, JQGridInterface

Class CurrencyManager is injected as alligator.currency_manager service. CurrencyManager handles the logic for entity.

Traits

Trait JQGridManagerTrait

Properties

protected CurrencyRepository $repository
protected Client $cache
protected Session $session
protected array $ratioList
protected array $currencies

Methods

mixed
searchForJQGRID(array $searchParams, array $sortParams = array(), array $additionalParams = array(), JQGridWrapper $jqGridWrapper = null)

No description

mixed
findAllForJQGRID(int $page, int $offset, array $sortParams, array $additionalParams = array(), JQGridWrapper $jqGridWrapper = null)

No description

mixed
getCountForJQGRID(array|null $searchParams = null, array|null $sortParams = null, array|null $additionalParams = array(), JQGridWrapper|null $jqGridWrapper = null)

No description

__construct(CurrencyRepository $repository, mixed $cache, Session $session)

No description

float
getRelativeRatio(string $referenceCurrencyCode, string $currencyCode)

Get ratio for specified currencies

Money
convert(Money $amount, string $currencyCode, $currencyRatio = null)

Convert the amount into the currencyCode given in parameter

saveCurrency(RatioStorage $currency)

Persist Currency

setDefaultCurrencyToCache()

Set default currency to cache

bool
changeCurrentDefaultCurrency()

Set isDefault param to false to default currency

bool
updateCurrencyToNewDefault(double $defaultRatio)

Update currency ratio for all currencies

array
getAllCurrencySign()

Ger array of all currency signs

array
getAllCurrencies()

Get all currencies from database

bool
deleteCurrencies(array $currenciesDB)

Delete multiple currencies

editCurrency(RatioStorage $ratioStorage)

Merge Currency. If currency is new default currency change currency ratio for other currencies

array
getCurrenciesArray(array $currencies)

Get multiple currencies from database

float|false
getCurrencyRatio(string $isoCode, string $provider = RatioStorageInterface::PROVIDER_GOOGLE)

Get currency ratio for specified code compared to default currency

float|int
getCurrencyRatioForPair(string $isoFrom, string $isoTo)

Get currency ratio for specified currencies

boolean
updateAutoCalculatedCurrencies()

Update all auto calculated currencies

float|int
simpleConvertMoney(mixed $price, mixed $from, mixed $to)

Do simple conversion for specified amount

mixed
getCurrentCurrency()

Get current currency code from session

array
getRatioList(bool $force = false)

Get ratio list

Details

in JQGridManagerTrait at line 26
mixed searchForJQGRID(array $searchParams, array $sortParams = array(), array $additionalParams = array(), JQGridWrapper $jqGridWrapper = null)

Parameters

array $searchParams
array $sortParams
array $additionalParams
JQGridWrapper $jqGridWrapper

Return Value

mixed

in JQGridManagerTrait at line 40
mixed findAllForJQGRID(int $page, int $offset, array $sortParams, array $additionalParams = array(), JQGridWrapper $jqGridWrapper = null)

Parameters

int $page
int $offset
array $sortParams
array $additionalParams
JQGridWrapper $jqGridWrapper

Return Value

mixed

in JQGridManagerTrait at line 53
mixed getCountForJQGRID(array|null $searchParams = null, array|null $sortParams = null, array|null $additionalParams = array(), JQGridWrapper|null $jqGridWrapper = null)

Parameters

array|null $searchParams
array|null $sortParams
array|null $additionalParams
JQGridWrapper|null $jqGridWrapper

Return Value

mixed

at line 63
__construct(CurrencyRepository $repository, mixed $cache, Session $session)

Parameters

CurrencyRepository $repository
mixed $cache
Session $session

at line 73
float getRelativeRatio(string $referenceCurrencyCode, string $currencyCode)

Get ratio for specified currencies

Parameters

string $referenceCurrencyCode
string $currencyCode

Return Value

float

Exceptions

AlligatorCurrencyException

at line 93
Money convert(Money $amount, string $currencyCode, $currencyRatio = null)

Convert the amount into the currencyCode given in parameter

Parameters

Money $amount
string $currencyCode in the list of currencies from config.yml
$currencyRatio

Return Value

Money

at line 109
RatioStorage saveCurrency(RatioStorage $currency)

Persist Currency

Parameters

RatioStorage $currency

Return Value

RatioStorage

at line 133
setDefaultCurrencyToCache()

Set default currency to cache

at line 153
bool changeCurrentDefaultCurrency()

Set isDefault param to false to default currency

Return Value

bool

at line 164
bool updateCurrencyToNewDefault(double $defaultRatio)

Update currency ratio for all currencies

Parameters

double $defaultRatio

Return Value

bool

at line 173
array getAllCurrencySign()

Ger array of all currency signs

Return Value

array

at line 196
array getAllCurrencies()

Get all currencies from database

Return Value

array

at line 210
bool deleteCurrencies(array $currenciesDB)

Delete multiple currencies

Parameters

array $currenciesDB

Return Value

bool

Exceptions

ORMException
OptimisticLockException

at line 223
RatioStorage editCurrency(RatioStorage $ratioStorage)

Merge Currency. If currency is new default currency change currency ratio for other currencies

Parameters

RatioStorage $ratioStorage

Return Value

RatioStorage

Exceptions

ORMException

at line 264
array getCurrenciesArray(array $currencies)

Get multiple currencies from database

Parameters

array $currencies

Return Value

array

at line 276
float|false getCurrencyRatio(string $isoCode, string $provider = RatioStorageInterface::PROVIDER_GOOGLE)

Get currency ratio for specified code compared to default currency

Parameters

string $isoCode
  • currency code to convert
string $provider
  • provider to execute conversion

Return Value

float|false

at line 309
float|int getCurrencyRatioForPair(string $isoFrom, string $isoTo)

Get currency ratio for specified currencies

Parameters

string $isoFrom
string $isoTo

Return Value

float|int

at line 325
boolean updateAutoCalculatedCurrencies()

Update all auto calculated currencies

Return Value

boolean

at line 347
float|int simpleConvertMoney(mixed $price, mixed $from, mixed $to)

Do simple conversion for specified amount

Parameters

mixed $price
mixed $from
mixed $to

Return Value

float|int

at line 365
mixed getCurrentCurrency()

Get current currency code from session

Return Value

mixed

at line 376
array getRatioList(bool $force = false)

Get ratio list

Parameters

bool $force

Return Value

array