271 lines
5.2 KiB
PHP
271 lines
5.2 KiB
PHP
<?php
|
|
|
|
namespace App\Entity;
|
|
|
|
use App\Repository\BookRepository;
|
|
use Doctrine\Common\Collections\ArrayCollection;
|
|
use Doctrine\Common\Collections\Collection;
|
|
use Doctrine\ORM\Mapping as ORM;
|
|
|
|
#[ORM\Entity(repositoryClass: BookRepository::class)]
|
|
class Book
|
|
{
|
|
#[ORM\Id]
|
|
#[ORM\GeneratedValue]
|
|
#[ORM\Column(type: 'integer')]
|
|
private $id;
|
|
|
|
#[ORM\Column(type: 'string', length: 255)]
|
|
private $Title;
|
|
|
|
#[ORM\Column(type: 'string', length: 255)]
|
|
private $language;
|
|
|
|
#[ORM\Column(type: 'text', nullable: true)]
|
|
private $description;
|
|
|
|
#[ORM\Column(type: 'string', length: 255, nullable: true)]
|
|
private $publisher;
|
|
|
|
#[ORM\Column(type: 'date', nullable: true)]
|
|
private $publish_date;
|
|
|
|
#[ORM\Column(type: 'string', length: 255, nullable: true)]
|
|
private $subtitle;
|
|
|
|
#[ORM\OneToMany(mappedBy: 'book', targetEntity: File::class, orphanRemoval: true)]
|
|
private $files;
|
|
|
|
#[ORM\Column(type: 'string', length: 255, nullable: true)]
|
|
private $isbn;
|
|
|
|
#[ORM\Column(type: 'string', length: 255, nullable: true)]
|
|
private $series;
|
|
|
|
#[ORM\Column(type: 'integer', nullable: true)]
|
|
private $volume;
|
|
|
|
#[ORM\Column(type: 'string', length: 255)]
|
|
private $author;
|
|
|
|
#[ORM\Column(type: 'text', nullable: true)]
|
|
private $tags;
|
|
|
|
#[ORM\Column(type: 'integer', nullable: true)]
|
|
private $pages;
|
|
|
|
#[ORM\Column(type: 'smallint', nullable: true)]
|
|
private $rating;
|
|
|
|
#[ORM\Column(type: 'text', nullable: true)]
|
|
private $category;
|
|
|
|
public function __construct()
|
|
{
|
|
$this->files = new ArrayCollection();
|
|
}
|
|
|
|
public function getId(): ?int
|
|
{
|
|
return $this->id;
|
|
}
|
|
|
|
public function getTitle(): ?string
|
|
{
|
|
return $this->Title;
|
|
}
|
|
|
|
public function setTitle(string $Title): self
|
|
{
|
|
$this->Title = $Title;
|
|
|
|
return $this;
|
|
}
|
|
|
|
public function getLanguage(): ?string
|
|
{
|
|
return $this->language;
|
|
}
|
|
|
|
public function setLanguage(string $language): self
|
|
{
|
|
$this->language = $language;
|
|
|
|
return $this;
|
|
}
|
|
|
|
public function getDescription(): ?string
|
|
{
|
|
return $this->description;
|
|
}
|
|
|
|
public function setDescription(?string $description): self
|
|
{
|
|
$this->description = $description;
|
|
|
|
return $this;
|
|
}
|
|
|
|
public function getPublisher(): ?string
|
|
{
|
|
return $this->publisher;
|
|
}
|
|
|
|
public function setPublisher(?string $publisher): self
|
|
{
|
|
$this->publisher = $publisher;
|
|
|
|
return $this;
|
|
}
|
|
|
|
public function getPublishDate(): ?\DateTimeInterface
|
|
{
|
|
return $this->publish_date;
|
|
}
|
|
|
|
public function setPublishDate(?\DateTimeInterface $publish_date): self
|
|
{
|
|
$this->publish_date = $publish_date;
|
|
|
|
return $this;
|
|
}
|
|
|
|
public function getSubtitle(): ?string
|
|
{
|
|
return $this->subtitle;
|
|
}
|
|
|
|
public function setSubtitle(?string $subtitle): self
|
|
{
|
|
$this->subtitle = $subtitle;
|
|
|
|
return $this;
|
|
}
|
|
|
|
/**
|
|
* @return Collection<int, File>
|
|
*/
|
|
public function getFiles(): Collection
|
|
{
|
|
return $this->files;
|
|
}
|
|
|
|
public function addFile(File $file): self
|
|
{
|
|
if (!$this->files->contains($file)) {
|
|
$this->files[] = $file;
|
|
$file->setBook($this);
|
|
}
|
|
|
|
return $this;
|
|
}
|
|
|
|
public function removeFile(File $file): self
|
|
{
|
|
if ($this->files->removeElement($file)) {
|
|
// set the owning side to null (unless already changed)
|
|
if ($file->getBook() === $this) {
|
|
$file->setBook(null);
|
|
}
|
|
}
|
|
|
|
return $this;
|
|
}
|
|
|
|
public function getIsbn(): ?string
|
|
{
|
|
return $this->isbn;
|
|
}
|
|
|
|
public function setIsbn(?string $isbn): self
|
|
{
|
|
$this->isbn = $isbn;
|
|
|
|
return $this;
|
|
}
|
|
|
|
public function getSeries(): ?string
|
|
{
|
|
return $this->series;
|
|
}
|
|
|
|
public function setSeries(?string $series): self
|
|
{
|
|
$this->series = $series;
|
|
|
|
return $this;
|
|
}
|
|
|
|
public function getVolume(): ?int
|
|
{
|
|
return $this->volume;
|
|
}
|
|
|
|
public function setVolume(?int $volume): self
|
|
{
|
|
$this->volume = $volume;
|
|
|
|
return $this;
|
|
}
|
|
|
|
public function getAuthor(): ?string
|
|
{
|
|
return $this->author;
|
|
}
|
|
|
|
public function setAuthor(string $author): self
|
|
{
|
|
$this->author = $author;
|
|
|
|
return $this;
|
|
}
|
|
|
|
public function getTags(): ?string
|
|
{
|
|
return $this->tags;
|
|
}
|
|
|
|
public function setTags(?string $tags): self
|
|
{
|
|
$this->tags = $tags;
|
|
|
|
return $this;
|
|
}
|
|
|
|
public function getPages(): ?int
|
|
{
|
|
return $this->pages;
|
|
}
|
|
|
|
public function setPages(?int $pages): self
|
|
{
|
|
$this->pages = $pages;
|
|
|
|
return $this;
|
|
}
|
|
|
|
public function getRating(): ?int
|
|
{
|
|
return $this->rating;
|
|
}
|
|
|
|
public function setRating(?int $rating): self
|
|
{
|
|
$this->rating = $rating;
|
|
|
|
return $this;
|
|
}
|
|
|
|
public function getCategory(): ?string
|
|
{
|
|
return $this->category;
|
|
}
|
|
|
|
public function setCategory(?string $category): self
|
|
{
|
|
$this->category = $category;
|
|
|
|
return $this;
|
|
}
|
|
}
|