RVRNEXT-11 add event for transactions

This commit is contained in:
bence committed 2023-05-28 16:48:37 +02:00
1 parent 49f3a371e5
commit 532dbfd8d6
6 files changed
+163 -20

No files matched your search

+26 -1
View File
@@ -7,10 +7,11 @@ class Transaction extends Model
{
protected static string $table = 'transactions';
protected static array $fields = ['community_id', 'currency_id', 'payer_user_id', 'payee_user_id', 'description', 'sum', 'time'];
protected static array $fields = ['community_id', 'event_id', 'currency_id', 'payer_user_id', 'payee_user_id', 'description', 'sum', 'time'];
protected static array $relations = [
'community' => Community::class,
'event' => Event::class,
'currency' => Currency::class,
'payer_user' => User::class,
'payee_user' => User::class
@@ -20,6 +21,10 @@ class Transaction extends Model
private int $communityId;
private ?Event $event = null;
private ?int $eventId = null;
private ?Currency $currency = null;
private int $currencyId;
@@ -48,6 +53,16 @@ class Transaction extends Model
$this->communityId = $communityId;
}
public function setEvent(?Event $event): void
{
$this->event = $event;
}
public function setEventId(?int $eventId): void
{
$this->eventId = $eventId;
}
public function setCurrency(Currency $currency): void
{
$this->currency = $currency;
@@ -108,6 +123,16 @@ class Transaction extends Model
return $this->communityId;
}
public function getEvent(): ?Event
{
return $this->event;
}
public function getEventId(): ?int
{
return $this->eventId;
}
public function getCurrency(): ?Currency
{
return $this->currency;