Property | Type | Description | |
---|---|---|---|
$accountBalanceAttribute | name of the account entity attribute, which should store current balance value. | ||
$accountLinkAttribute | name of the transaction entity attribute, which should be used to link transaction entity with account entity (store associated account ID). | ||
$amountAttribute | name of the transaction entity attribute, which should store amount. | ||
$autoCreateAccount | whether to automatically create requested account, if it does not yet exist. | ||
$dateAttribute | name of the transaction entity attribute, which should store date. | ||
$dateAttributeValue | value which should be used for new transaction date composition. This can be plain value, object like [[\yii\db\Expression]] or a PHP callback, which returns it. If not set PHP time() function will be used. | ||
$extraAccountLinkAttribute | name of the transaction entity attribute, which should store additional affected account ID. This attribute will be filled only at transfer() method execution and will store ID of the account transferred from or to, depending on the context. If not set, no information about the extra account context will be saved. Note: absence of this field will affect logic of some methods like Manager::revert. |
Method | Description | |
---|---|---|
decrease ( $account, $amount, $data = [] ) | ||
increase ( $account, $amount, $data = [] ) | ||
revert ( $transactionId, $data = [] ) | ||
transfer ( $from, $to, $amount, $data = [] ) |
Method | Description | |
---|---|---|
afterCreateTransaction ( mixed $transactionId, mixed $accountId, array $data ) : array | This method is invoked after transaction has been created. | |
beforeCreateTransaction ( mixed $accountId, array $data ) : array | This method is invoked before creating transaction. | |
createAccount ( array $attributes ) : mixed | Creates new account with given attributes. | |
createTransaction ( array $attributes ) : mixed | Writes transaction data into persistent storage. | |
fetchAccountId ( mixed $idOrFilter ) : mixed | ||
findAccountId ( array $attributes ) : mixed | null | Finds account ID matching given filter attributes. | |
findTransaction ( mixed $id ) : array | null | Finds transaction data by ID. | |
getDateAttributeValue ( ) : mixed | Returns actual now date value for the transaction. | |
incrementAccountBalance ( mixed $accountId, integer | float $amount ) | Increases current account balance value. |
abstract protected createAccount ( array $attributes ) : mixed | ||
$attributes | array | account attributes in format: attribute => value |
return | mixed | created account ID. |
abstract protected createTransaction ( array $attributes ) : mixed | ||
$attributes | array | attributes associated with transaction in format: attribute => value |
return | mixed | new transaction ID. |
protected fetchAccountId ( mixed $idOrFilter ) : mixed | ||
$idOrFilter | mixed | account ID or filter condition. |
return | mixed | account ID. |
protected getDateAttributeValue ( ) : mixed | ||
return | mixed | date attribute value. |
public $accountBalanceAttribute |
public $accountLinkAttribute |
public $amountAttribute |
public $autoCreateAccount |
public $dateAttribute |
public $dateAttributeValue |
public $extraAccountLinkAttribute |