diff options
author | Daniel Weipert <code@drogueronin.de> | 2023-11-29 11:03:15 +0100 |
---|---|---|
committer | Daniel Weipert <code@drogueronin.de> | 2023-11-29 11:03:15 +0100 |
commit | fa9096c0ab521aae45cab6c48a54290d14a221b9 (patch) | |
tree | 61466b792c2714848cfea00594456ac06c259c94 /src/Model/Event/BaseEvent.php | |
parent | 3afcaef927391db23fe23c6c8c26b8960e8dae32 (diff) |
event tables
Diffstat (limited to 'src/Model/Event/BaseEvent.php')
-rw-r--r-- | src/Model/Event/BaseEvent.php | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/src/Model/Event/BaseEvent.php b/src/Model/Event/BaseEvent.php index d3cc3fb..0c1795b 100644 --- a/src/Model/Event/BaseEvent.php +++ b/src/Model/Event/BaseEvent.php @@ -2,6 +2,9 @@ namespace App\Model\Event; +use App\DB; +use App\Model\Event; + abstract class BaseEvent { public int $id; @@ -10,5 +13,17 @@ abstract class BaseEvent public \DateTime $createdAt; public \DateTime $updatedAt; - abstract function sqlInsert(): void; + public Event $event; + + abstract function dbInsert(): void; + abstract function dbDelete(): void; + + public function getEvent(): Event + { + if (! isset($this->event)) { + $this->event = DB::fetch(Event::class, 'select * from events where id=:id', ['id' => $this->eventId])[0]; + } + + return $this->event; + } } |