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',
],
],
...
];
Afficher le fichier
Open project: yii2tech/balance
Méthodes publiques
Свойство |
Type |
Description |
|
$accountClass |
|
name of the ActiveRecord class, which should store account records. |
|
$transactionClass |
|
name of the ActiveRecord class, which should store transaction records. |
|
Méthodes publiques
Méthodes protégées
Method Details
calculateBalance()
public méthode
createAccount()
protected méthode
createDbTransaction()
protected méthode
createTransaction()
protected méthode
findAccountId()
protected méthode
findTransaction()
protected méthode
incrementAccountBalance()
protected méthode
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.