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', ], ], ... ];
See also: Manager
Since: 1.0
Author: Paul Klimov ([email protected])
Inheritance: extends ManagerDbTransaction, use trait ManagerDataSerializeTrait
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éthode Description
calculateBalance ( $account )

Méthodes protégées

Méthode Description
createAccount ( $attributes )
createDbTransaction ( )
createTransaction ( $attributes )
findAccountId ( $attributes )
findTransaction ( $id )
incrementAccountBalance ( $accountId, $amount )

Method Details

calculateBalance() public méthode

public calculateBalance ( $account )

createAccount() protected méthode

protected createAccount ( $attributes )

createDbTransaction() protected méthode

protected createDbTransaction ( )

createTransaction() protected méthode

protected createTransaction ( $attributes )

findAccountId() protected méthode

protected findAccountId ( $attributes )

findTransaction() protected méthode

protected findTransaction ( $id )

incrementAccountBalance() protected méthode

protected incrementAccountBalance ( $accountId, $amount )

Property Details

$accountClass public_oe property

name of the ActiveRecord class, which should store account records.
public $accountClass

$transactionClass public_oe property

name of the ActiveRecord class, which should store transaction records.
public $transactionClass