download
raw
6.06 kB
<?php
namespace App\Entity;
use App\Enum\BookStatus;
use App\Repository\BookRepository;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\DBAL\Types\Types;
use Doctrine\ORM\Mapping as ORM;
#[ORM\Entity(repositoryClass: BookRepository::class)]
class Book
{
#[ORM\Id]
#[ORM\GeneratedValue]
#[ORM\Column]
private ?int $id = null;
#[ORM\Column(length: 255)]
private ?string $title = null;
#[ORM\Column(length: 50)]
private ?string $isbn = null;
#[ORM\Column(length: 255)]
private ?string $cover = null;
#[ORM\Column]
private ?\DateTimeImmutable $editedAt = null;
#[ORM\Column(type: Types::TEXT, nullable: true)]
private ?string $plot = null;
#[ORM\Column]
private ?int $pageNumber = null;
#[ORM\Column(nullable: true)]
private ?int $year = null;
#[ORM\Column(length: 255, nullable: true)]
private ?string $genre = null;
#[ORM\Column(length: 255)]
private ?BookStatus $status = null;
#[ORM\ManyToOne(inversedBy: 'books')]
#[ORM\JoinColumn(nullable: false)]
private ?Editor $editor = null;
/**
* @var Collection<int, Author>
*/
#[ORM\ManyToMany(targetEntity: Author::class, mappedBy: 'books')]
private Collection $authors;
/**
* @var Collection<int, Comment>
*/
#[ORM\OneToMany(targetEntity: Comment::class, mappedBy: 'book')]
private Collection $comments;
/**
* @var Collection<int, Reservation>
*/
#[ORM\OneToMany(targetEntity: Reservation::class, mappedBy: 'book')]
private Collection $reservations;
public function __construct()
{
$this->authors = new ArrayCollection();
$this->comments = new ArrayCollection();
$this->reservations = new ArrayCollection();
}
public function getId(): ?int
{
return $this->id;
}
public function getTitle(): ?string
{
return $this->title;
}
public function setTitle(string $title): static
{
$this->title = $title;
return $this;
}
public function getIsbn(): ?string
{
return $this->isbn;
}
public function setIsbn(string $isbn): static
{
$this->isbn = $isbn;
return $this;
}
public function getCover(): ?string
{
return $this->cover;
}
public function setCover(string $cover): static
{
$this->cover = $cover;
return $this;
}
public function getEditedAt(): ?\DateTimeImmutable
{
return $this->editedAt;
}
public function setEditedAt(\DateTimeImmutable $editedAt): static
{
$this->editedAt = $editedAt;
return $this;
}
public function getPlot(): ?string
{
return $this->plot;
}
public function setPlot(?string $plot): static
{
$this->plot = $plot;
return $this;
}
public function getPageNumber(): ?int
{
return $this->pageNumber;
}
public function setPageNumber(int $pageNumber): static
{
$this->pageNumber = $pageNumber;
return $this;
}
public function getYear(): ?int
{
return $this->year;
}
public function setYear(?int $year): static
{
$this->year = $year;
return $this;
}
public function getGenre(): ?string
{
return $this->genre;
}
public function setGenre(?string $genre): static
{
$this->genre = $genre;
return $this;
}
public function getStatus(): ?BookStatus
{
return $this->status;
}
public function setStatus(BookStatus $status): static
{
$this->status = $status;
return $this;
}
public function getEditor(): ?Editor
{
return $this->editor;
}
public function setEditor(?Editor $editor): static
{
$this->editor = $editor;
return $this;
}
/**
* @return Collection<int, Author>
*/
public function getAuthors(): Collection
{
return $this->authors;
}
public function addAuthor(Author $author): static
{
if (!$this->authors->contains($author)) {
$this->authors->add($author);
$author->addBook($this);
}
return $this;
}
public function removeAuthor(Author $author): static
{
if ($this->authors->removeElement($author)) {
$author->removeBook($this);
}
return $this;
}
/**
* @return Collection<int, Comment>
*/
public function getComments(): Collection
{
return $this->comments;
}
public function addComment(Comment $comment): static
{
if (!$this->comments->contains($comment)) {
$this->comments->add($comment);
$comment->setBook($this);
}
return $this;
}
public function removeComment(Comment $comment): static
{
if ($this->comments->removeElement($comment)) {
// set the owning side to null (unless already changed)
if ($comment->getBook() === $this) {
$comment->setBook(null);
}
}
return $this;
}
/**
* @return Collection<int, Reservation>
*/
public function getReservations(): Collection
{
return $this->reservations;
}
public function addReservation(Reservation $reservation): static
{
if (!$this->reservations->contains($reservation)) {
$this->reservations->add($reservation);
$reservation->setBook($this);
}
return $this;
}
public function removeReservation(Reservation $reservation): static
{
if ($this->reservations->removeElement($reservation)) {
// set the owning side to null (unless already changed)
if ($reservation->getBook() === $this) {
$reservation->setBook(null);
}
}
return $this;
}
}

Xet Storage Details

Size:
6.06 kB
·
Xet hash:
2fe7ee7d01a80cd87a42aa6b5d399cae0c2ffee5ee68c4208fb60966481fb356

Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.