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