PHP Class yii2tech\balance\ManagerActiveRecord
This manager allows usage of any storage, which have ActiveRecord interface implemented, such as
relational DB, MongoDB, Redis etc. However, it may lack efficiency comparing to the dedicated managers
like
ManagerDb or
ManagerMongoDb.
Configuration example:
php
return [
'components' => [
'balanceManager' => [
'class' => 'yii2tech\balance\ManagerActiveRecord',
'accountClass' => 'app\models\BalanceAccount',
'transactionClass' => 'app\models\BalanceTransaction',
'accountBalanceAttribute' => 'balance',
'extraAccountLinkAttribute' => 'extraAccountId',
'dataAttribute' => 'data',
],
],
...
];
Mostrar archivo
Open project: yii2tech/balance
Public Properties
Property |
Type |
Description |
|
$accountClass |
|
name of the ActiveRecord class, which should store account records. |
|
$transactionClass |
|
name of the ActiveRecord class, which should store transaction records. |
|
Public Methods
Protected Methods
Method Details
calculateBalance()
public method
createAccount()
protected method
createDbTransaction()
protected method
createTransaction()
protected method
findAccountId()
protected method
findTransaction()
protected method
incrementAccountBalance()
protected method
Property Details
$accountClass public_oe property
name of the ActiveRecord class, which should store account records.
$transactionClass public_oe property
name of the ActiveRecord class, which should store transaction records.