PHP 클래스 yii2tech\balance\ManagerDb

Configuration example: php return [ 'components' => [ 'balanceManager' => [ 'class' => 'yii2tech\balance\ManagerDb', 'accountTable' => '{{%BalanceAccount}}', 'transactionTable' => '{{%BalanceTransaction}}', 'accountBalanceAttribute' => 'balance', 'extraAccountLinkAttribute' => 'extraAccountId', 'dataAttribute' => 'data', ], ], ... ]; Database migration example: php $this->createTable('BalanceAccount', [ 'id' => $this->primaryKey(), 'balance' => $this->integer()->notNull()->defaultValue(0), ... ]); $this->createTable('BalanceTransaction', [ 'id' => $this->primaryKey(), 'date' => $this->integer()->notNull(), 'accountId' => $this->integer()->notNull(), 'extraAccountId' => $this->integer()->notNull(), 'amount' => $this->integer()->notNull()->defaultValue(0), 'data' => $this->text(), ... ]);
또한 보기: Manager
부터: 1.0
저자: Paul Klimov ([email protected])
상속: extends ManagerDbTransaction, use trait ManagerDataSerializeTrait
파일 보기 프로젝트 열기: yii2tech/balance

공개 프로퍼티들

프로퍼티 타입 설명
$accountTable name of the database table, which should store account records.
$db the DB connection object or the application component ID of the DB connection. After the ManagerDb object is created, if you want to change this property, you should only assign it with a DB connection object.
$transactionTable name of the database table, which should store transaction records.

공개 메소드들

메소드 설명
calculateBalance ( $account )
getAccountIdAttribute ( ) : string
getTransactionIdAttribute ( ) : string
init ( )
setAccountIdAttribute ( string $accountIdAttribute )
setTransactionIdAttribute ( string $transactionIdAttribute )

보호된 메소드들

메소드 설명
createAccount ( $attributes )
createDbTransaction ( )
createTransaction ( $attributes )
findAccountId ( $attributes )
findTransaction ( $id )
incrementAccountBalance ( $accountId, $amount )

메소드 상세

calculateBalance() 공개 메소드

public calculateBalance ( $account )

createAccount() 보호된 메소드

protected createAccount ( $attributes )

createDbTransaction() 보호된 메소드

protected createDbTransaction ( )

createTransaction() 보호된 메소드

protected createTransaction ( $attributes )

findAccountId() 보호된 메소드

protected findAccountId ( $attributes )

findTransaction() 보호된 메소드

protected findTransaction ( $id )

getAccountIdAttribute() 공개 메소드

public getAccountIdAttribute ( ) : string
리턴 string

getTransactionIdAttribute() 공개 메소드

incrementAccountBalance() 보호된 메소드

protected incrementAccountBalance ( $accountId, $amount )

init() 공개 메소드

public init ( )

setAccountIdAttribute() 공개 메소드

public setAccountIdAttribute ( string $accountIdAttribute )
$accountIdAttribute string

setTransactionIdAttribute() 공개 메소드

public setTransactionIdAttribute ( string $transactionIdAttribute )
$transactionIdAttribute string

프로퍼티 상세

$accountTable 공개적으로 프로퍼티

name of the database table, which should store account records.
public $accountTable

$db 공개적으로 프로퍼티

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

$transactionTable 공개적으로 프로퍼티

name of the database table, which should store transaction records.
public $transactionTable