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
파일 보기 프로젝트 열기: yii2tech/balance

공개 프로퍼티들

프로퍼티 타입 설명
$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