Jacek Kowalski
4 hours ago 6b9278a5d57091fce636dbb640b380cfb990db6c
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
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
<?php
declare(strict_types=1);
 
namespace App\Entity;
 
use Doctrine\ORM\Mapping as ORM;
 
/**
 * A finished loan. It has a surrogate key because Doctrine cannot use dates in identifiers;
 * the (book, at) pair stays unique through a constraint on each concrete table.
 */
#[ORM\MappedSuperclass]
abstract class AbstractBorrowHistory {
    #[ORM\Id]
    #[ORM\GeneratedValue]
    #[ORM\Column]
    private ?int $id = null;
 
    #[ORM\Column(length: 255)]
    private string $who;
 
    #[ORM\Column]
    private \DateTimeImmutable $at;
 
    #[ORM\Column]
    private \DateTimeImmutable $till;
 
    public function __construct(string $who, \DateTimeImmutable $at, \DateTimeImmutable $till) {
        $this->who = $who;
        $this->at = $at;
        $this->till = $till;
    }
 
    public function getId(): ?int {
        return $this->id;
    }
 
    public function getWho(): string {
        return $this->who;
    }
 
    public function getAt(): \DateTimeImmutable {
        return $this->at;
    }
 
    public function getTill(): \DateTimeImmutable {
        return $this->till;
    }
}