src/Entity/Ebook.php line 11

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Repository\EbookRepository;
  4. use Doctrine\Common\Collections\ArrayCollection;
  5. use Doctrine\Common\Collections\Collection;
  6. use Doctrine\ORM\Mapping as ORM;
  7. #[ORM\Entity(repositoryClassEbookRepository::class)]
  8. class Ebook
  9. {
  10.     #[ORM\Id]
  11.     #[ORM\GeneratedValue]
  12.     #[ORM\Column(type'integer')]
  13.     private $id;
  14.     #[ORM\ManyToOne(targetEntityAccountingFirm::class, inversedBy'ebooks')]
  15.     #[ORM\JoinColumn(nullablefalse)]
  16.     private $accountingFirm;
  17.     #[ORM\Column(type'string'length255)]
  18.     private $title;
  19.     #[ORM\Column(type'text')]
  20.     private $description;
  21.     #[ORM\OneToMany(targetEntityImage::class, mappedBy'ebook'cascade: ['all'])]
  22.     private $images;
  23.     #[ORM\OneToMany(targetEntityDocument::class, mappedBy'ebook'cascade: ['all'])]
  24.     private $documents;
  25.     public function __construct()
  26.     {
  27.         $this->images = new ArrayCollection();
  28.         $this->documents = new ArrayCollection();
  29.     }
  30.     public function getId(): ?int
  31.     {
  32.         return $this->id;
  33.     }
  34.     public function getAccountingFirm(): ?AccountingFirm
  35.     {
  36.         return $this->accountingFirm;
  37.     }
  38.     public function setAccountingFirm(?AccountingFirm $accountingFirm): self
  39.     {
  40.         $this->accountingFirm $accountingFirm;
  41.         return $this;
  42.     }
  43.     public function getTitle(): ?string
  44.     {
  45.         return $this->title;
  46.     }
  47.     public function setTitle(string $title): self
  48.     {
  49.         $this->title $title;
  50.         return $this;
  51.     }
  52.     public function getDescription(): ?string
  53.     {
  54.         return $this->description;
  55.     }
  56.     public function setDescription(string $description): self
  57.     {
  58.         $this->description $description;
  59.         return $this;
  60.     }
  61.     /**
  62.      * @return Collection|Image[]
  63.      */
  64.     public function getImages(): Collection
  65.     {
  66.         return $this->images;
  67.     }
  68.     public function addImage(Image $image): self
  69.     {
  70.         if (!$this->images->contains($image)) {
  71.             $this->images[] = $image;
  72.             $image->setEbook($this);
  73.         }
  74.         return $this;
  75.     }
  76.     public function removeImage(Image $image): self
  77.     {
  78.         if ($this->images->removeElement($image)) {
  79.             // set the owning side to null (unless already changed)
  80.             if ($image->getEbook() === $this) {
  81.                 $image->setEbook(null);
  82.             }
  83.         }
  84.         return $this;
  85.     }
  86.     /**
  87.      * @return Collection|Document[]
  88.      */
  89.     public function getDocuments(): Collection
  90.     {
  91.         return $this->documents;
  92.     }
  93.     public function addDocument(Document $document): self
  94.     {
  95.         if (!$this->documents->contains($document)) {
  96.             $this->documents[] = $document;
  97.             $document->setEbook($this);
  98.         }
  99.         return $this;
  100.     }
  101.     public function removeDocument(Document $document): self
  102.     {
  103.         if ($this->documents->removeElement($document)) {
  104.             // set the owning side to null (unless already changed)
  105.             if ($document->getEbook() === $this) {
  106.                 $document->setEbook(null);
  107.             }
  108.         }
  109.         return $this;
  110.     }
  111. }