<?php namespace RVR\PersistentData\Model; use DateTime; use SokoWeb\PersistentData\Model\Model; class Transaction extends Model { protected static string $table = 'transactions'; 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 ]; private ?Community $community = null; private int $communityId; private ?Event $event = null; private ?int $eventId = null; private ?Currency $currency = null; private int $currencyId; private ?User $payerUser = null; private int $payerUserId; private ?User $payeeUser = null; private ?int $payeeUserId = null; private string $description = ''; private float $sum = 0.0; private DateTime $time; public function setCommunity(Community $community): void { $this->community = $community; } public function setCommunityId(int $communityId): void { $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; } public function setCurrencyId(int $currencyId): void { $this->currencyId = $currencyId; } public function setPayerUser(User $payerUser): void { $this->payerUser = $payerUser; } public function setPayerUserId(int $payerUserId): void { $this->payerUserId = $payerUserId; } public function setPayeeUser(?User $payeeUser): void { $this->payeeUser = $payeeUser; } public function setPayeeUserId(?int $payeeUserId): void { $this->payeeUserId = $payeeUserId; } public function setDescription(string $description): void { $this->description = $description; } public function setSum(float $sum): void { $this->sum = $sum; } public function setTimeDate(DateTime $time): void { $this->time = $time; } public function setTime(string $time): void { $this->time = new DateTime($time); } public function getCommunity(): ?Community { return $this->community; } public function getCommunityId(): int { return $this->communityId; } public function getEvent(): ?Event { return $this->event; } public function getEventId(): ?int { return $this->eventId; } public function getCurrency(): ?Currency { return $this->currency; } public function getCurrencyId(): int { return $this->currencyId; } public function getPayerUser(): ?User { return $this->payerUser; } public function getPayerUserId(): int { return $this->payerUserId; } public function getPayeeUser(): ?User { return $this->payeeUser; } public function getPayeeUserId(): ?int { return $this->payeeUserId; } public function getDescription(): string { return $this->description; } public function getSum(): float { return $this->sum; } public function getTimeDate(): DateTime { return $this->time; } public function getTime(): string { return $this->time->format('Y-m-d H:i:s'); } }