v0.1.0
This commit is contained in:
43
backend/api/src/Transaction.php
Normal file
43
backend/api/src/Transaction.php
Normal file
@ -0,0 +1,43 @@
|
||||
<?php
|
||||
namespace ProVM\Crypto;
|
||||
|
||||
use ProVM\Common\Alias\Model;
|
||||
use ProVM\Common\Define\Model\DateTime as DT;
|
||||
|
||||
/**
|
||||
* @property int $id
|
||||
* @property \DateTime $date_time
|
||||
* @property Coin $coin_id
|
||||
* @property Wallet $wallet_id
|
||||
* @property float $amount
|
||||
* @property float $value
|
||||
* @property Coin $unit_id
|
||||
*/
|
||||
class Transaction extends Model {
|
||||
use DT;
|
||||
|
||||
protected static $_table = 'transactions';
|
||||
protected static $fields = ['date_time', 'coin_id', 'wallet_id', 'amount', 'value', 'unit_id'];
|
||||
|
||||
protected $coin;
|
||||
public function coin() {
|
||||
if ($this->coin === null) {
|
||||
$this->coin = $this->childOf(Coin::class, [Model::SELF_KEY => 'coin_id']);
|
||||
}
|
||||
return $this->coin;
|
||||
}
|
||||
protected $wallet;
|
||||
public function wallet() {
|
||||
if ($this->wallet === null) {
|
||||
$this->wallet = $this->childOf(Wallet::class, [Model::SELF_KEY => 'wallet_id']);
|
||||
}
|
||||
return $this->wallet;
|
||||
}
|
||||
protected $unit;
|
||||
public function unit() {
|
||||
if ($this->unit === null) {
|
||||
$this->unit = $this->childOf(Coin::class, [Model::SELF_KEY => 'unit_id']);
|
||||
}
|
||||
return $this->unit;
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user