summaryrefslogtreecommitdiff
path: root/src/Model/Event/BaseEvent.php
blob: 0d504583ff2e4a222c9ff9377c670bee9dc7f4a6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
<?php

namespace App\Model\Event;

use App\DB;
use App\Model\Event;

abstract class BaseEvent
{
  public int $id;
  public int $eventId;

  public \DateTime $createdAt;
  public \DateTime $updatedAt;

  public Event $event;

  abstract function create(): void;
  abstract function cancel(): void;
  abstract function dbInsert(): void;
  abstract function dbDelete(): void;

  public function populateEvent(): void
  {
    if (! isset($this->event)) {
      $this->event = DB::fetch(Event::class, 'select * from events where id=:id', ['id' => $this->eventId])[0];
    }
  }
}