<?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;
|
}
|
}
|