33 lines
746 B
PHP
33 lines
746 B
PHP
|
<?php
|
||
|
namespace ProVM\Money;
|
||
|
|
||
|
use ProVM\Common\Alias\Model;
|
||
|
use ProVM\Common\Define\Model\DateTime;
|
||
|
|
||
|
/**
|
||
|
* @property Currency $currency_id
|
||
|
* @property \DateTime $date_time
|
||
|
* @property double $value
|
||
|
* @property Currency $base_id
|
||
|
*/
|
||
|
class Value {
|
||
|
use DateTime;
|
||
|
|
||
|
public static $_table = 'values';
|
||
|
|
||
|
protected $currency;
|
||
|
public function currency(): ?Currency {
|
||
|
if ($this->currency === null) {
|
||
|
$this->currency = $this->childOf(Currency::class, [Model::SELF_KEY => 'currency_id']);
|
||
|
}
|
||
|
return $this->currency;
|
||
|
}
|
||
|
protected $base;
|
||
|
public function base(): ?Currency {
|
||
|
if ($this->base === null) {
|
||
|
$this->base = $this->childOf(Currency::class, [Model::SELF_KEY => 'base_id']);
|
||
|
}
|
||
|
return $this->base;
|
||
|
}
|
||
|
}
|