PHP Класс yii2tech\balance\ManagerMongoDb

This storage requires yiisoft/yii2-mongodb extension installed. Configuration example: php return [ 'components' => [ 'balanceManager' => [ 'class' => 'yii2tech\balance\ManagerMongoDb', 'accountCollection' => 'BalanceAccount', 'transactionCollection' => 'BalanceTransaction', 'accountBalanceAttribute' => 'balance', 'extraAccountLinkAttribute' => 'extraAccountId', ], ], ... ]; Since MongoDB is schema-less this manager allows to save any transaction data as plain record attribute, which will be searchable. However MongoDB does not support transactions, thus usage of this manager may be risk prone.
См. также: Manager
С версии: 1.0
Автор: Paul Klimov ([email protected])
Наследование: extends Manager
Показать файл Открыть проект

Открытые свойства

Свойство Тип Описание
$accountCollection name of the MongoDB collection, which should store account records.
$db the MongoDB connection object or the application component ID of the MongoDB connection. After the ManagerMongoDb object is created, if you want to change this property, you should only assign it with a MongoDB connection object.
$transactionCollection name of the MongoDB collection, which should store transaction records.

Открытые методы

Метод Описание
calculateBalance ( $account )
init ( )

Защищенные методы

Метод Описание
createAccount ( $attributes )
createTransaction ( $attributes )
findAccountId ( $attributes )
findTransaction ( $id )
incrementAccountBalance ( $accountId, $amount )

Описание методов

calculateBalance() публичный Метод

public calculateBalance ( $account )

createAccount() защищенный Метод

protected createAccount ( $attributes )

createTransaction() защищенный Метод

protected createTransaction ( $attributes )

findAccountId() защищенный Метод

protected findAccountId ( $attributes )

findTransaction() защищенный Метод

protected findTransaction ( $id )

incrementAccountBalance() защищенный Метод

protected incrementAccountBalance ( $accountId, $amount )

init() публичный Метод

public init ( )

Описание свойств

$accountCollection публичное свойство

name of the MongoDB collection, which should store account records.
public $accountCollection

$db публичное свойство

the MongoDB connection object or the application component ID of the MongoDB connection. After the ManagerMongoDb object is created, if you want to change this property, you should only assign it with a MongoDB connection object.
public $db

$transactionCollection публичное свойство

name of the MongoDB collection, which should store transaction records.
public $transactionCollection