84 lines
1.7 KiB
PHP
84 lines
1.7 KiB
PHP
<?php namespace RVR\PersistentData\Model;
|
|
|
|
use DateTime;
|
|
use SokoWeb\PersistentData\Model\Model;
|
|
|
|
class Community extends Model
|
|
{
|
|
protected static string $table = 'communities';
|
|
|
|
protected static array $fields = ['name', 'currency', 'main_currency_id', 'created'];
|
|
|
|
protected static array $relations = ['main_currency' => Currency::class];
|
|
|
|
private string $name = '';
|
|
|
|
private string $currency = '';
|
|
|
|
private ?Currency $mainCurrency = null;
|
|
|
|
private ?int $mainCurrencyId = null;
|
|
|
|
private DateTime $created;
|
|
|
|
public function setName(string $name): void
|
|
{
|
|
$this->name = $name;
|
|
}
|
|
|
|
public function setCurrency(string $currency): void
|
|
{
|
|
$this->currency = $currency;
|
|
}
|
|
|
|
public function setMainCurrency(Currency $mainCurrency): void
|
|
{
|
|
$this->mainCurrency = $mainCurrency;
|
|
}
|
|
|
|
public function setMainCurrencyId(int $mainCurrencyId): void
|
|
{
|
|
$this->mainCurrencyId = $mainCurrencyId;
|
|
}
|
|
|
|
public function setCreatedDate(DateTime $created): void
|
|
{
|
|
$this->created = $created;
|
|
}
|
|
|
|
public function setCreated(string $created): void
|
|
{
|
|
$this->created = new DateTime($created);
|
|
}
|
|
|
|
public function getName(): string
|
|
{
|
|
return $this->name;
|
|
}
|
|
|
|
public function getCurrency(): string
|
|
{
|
|
return $this->currency;
|
|
}
|
|
|
|
public function getMainCurrency(): ?Currency
|
|
{
|
|
return $this->mainCurrency;
|
|
}
|
|
|
|
public function getMainCurrencyId(): ?int
|
|
{
|
|
return $this->mainCurrencyId;
|
|
}
|
|
|
|
public function getCreatedDate(): DateTime
|
|
{
|
|
return $this->created;
|
|
}
|
|
|
|
public function getCreated(): string
|
|
{
|
|
return $this->created->format('Y-m-d H:i:s');
|
|
}
|
|
}
|