Added files to books.

This commit is contained in:
krzysiej
2022-05-20 15:06:40 +02:00
parent 210318eca4
commit cf3b357300
3 changed files with 202 additions and 0 deletions

96
src/Entity/File.php Normal file
View File

@@ -0,0 +1,96 @@
<?php
namespace App\Entity;
use App\Repository\FileRepository;
use Doctrine\ORM\Mapping as ORM;
#[ORM\Entity(repositoryClass: FileRepository::class)]
class File
{
#[ORM\Id]
#[ORM\GeneratedValue]
#[ORM\Column(type: 'integer')]
private $id;
#[ORM\Column(type: 'string', length: 255)]
private $file_name;
#[ORM\Column(type: 'integer')]
private $file_size;
#[ORM\Column(type: 'string', length: 255)]
private $extension;
#[ORM\Column(type: 'string', length: 255)]
private $type;
#[ORM\ManyToOne(targetEntity: Book::class, inversedBy: 'files')]
#[ORM\JoinColumn(nullable: false)]
private $book;
public function getId(): ?int
{
return $this->id;
}
public function getFileName(): ?string
{
return $this->file_name;
}
public function setFileName(string $file_name): self
{
$this->file_name = $file_name;
return $this;
}
public function getFileSize(): ?int
{
return $this->file_size;
}
public function setFileSize(int $file_size): self
{
$this->file_size = $file_size;
return $this;
}
public function getExtension(): ?string
{
return $this->extension;
}
public function setExtension(string $extension): self
{
$this->extension = $extension;
return $this;
}
public function getType(): ?string
{
return $this->type;
}
public function setType(string $type): self
{
$this->type = $type;
return $this;
}
public function getBook(): ?Book
{
return $this->book;
}
public function setBook(?Book $book): self
{
$this->book = $book;
return $this;
}
}