<?php
|
declare(strict_types=1);
|
|
namespace App\Entity;
|
|
use App\Repository\BorrowRepository;
|
use Doctrine\ORM\Mapping as ORM;
|
|
#[ORM\Entity(repositoryClass: BorrowRepository::class)]
|
class Borrow {
|
#[ORM\Id]
|
#[ORM\OneToOne(targetEntity: Book::class, inversedBy: 'borrow')]
|
#[ORM\JoinColumn(nullable: false)]
|
private Book $book;
|
|
#[ORM\Column(length: 255)]
|
private string $who;
|
|
#[ORM\Column]
|
private \DateTimeImmutable $at;
|
|
public function __construct(Book $book, string $who, \DateTimeImmutable $at) {
|
$this->book = $book;
|
$this->who = $who;
|
$this->at = $at;
|
}
|
|
public function getBook(): Book {
|
return $this->book;
|
}
|
|
public function getWho(): string {
|
return $this->who;
|
}
|
|
public function getAt(): \DateTimeImmutable {
|
return $this->at;
|
}
|
}
|