<?phpnamespace App\Entity;use App\Repository\EbookRepository;use Doctrine\Common\Collections\ArrayCollection;use Doctrine\Common\Collections\Collection;use Doctrine\ORM\Mapping as ORM;#[ORM\Entity(repositoryClass: EbookRepository::class)]class Ebook{ #[ORM\Id] #[ORM\GeneratedValue] #[ORM\Column(type: 'integer')] private $id; #[ORM\ManyToOne(targetEntity: AccountingFirm::class, inversedBy: 'ebooks')] #[ORM\JoinColumn(nullable: false)] private $accountingFirm; #[ORM\Column(type: 'string', length: 255)] private $title; #[ORM\Column(type: 'text')] private $description; #[ORM\OneToMany(targetEntity: Image::class, mappedBy: 'ebook', cascade: ['all'])] private $images; #[ORM\OneToMany(targetEntity: Document::class, mappedBy: 'ebook', cascade: ['all'])] private $documents; public function __construct() { $this->images = new ArrayCollection(); $this->documents = new ArrayCollection(); } public function getId(): ?int { return $this->id; } public function getAccountingFirm(): ?AccountingFirm { return $this->accountingFirm; } public function setAccountingFirm(?AccountingFirm $accountingFirm): self { $this->accountingFirm = $accountingFirm; return $this; } public function getTitle(): ?string { return $this->title; } public function setTitle(string $title): self { $this->title = $title; return $this; } public function getDescription(): ?string { return $this->description; } public function setDescription(string $description): self { $this->description = $description; return $this; } /** * @return Collection|Image[] */ public function getImages(): Collection { return $this->images; } public function addImage(Image $image): self { if (!$this->images->contains($image)) { $this->images[] = $image; $image->setEbook($this); } return $this; } public function removeImage(Image $image): self { if ($this->images->removeElement($image)) { // set the owning side to null (unless already changed) if ($image->getEbook() === $this) { $image->setEbook(null); } } return $this; } /** * @return Collection|Document[] */ public function getDocuments(): Collection { return $this->documents; } public function addDocument(Document $document): self { if (!$this->documents->contains($document)) { $this->documents[] = $document; $document->setEbook($this); } return $this; } public function removeDocument(Document $document): self { if ($this->documents->removeElement($document)) { // set the owning side to null (unless already changed) if ($document->getEbook() === $this) { $document->setEbook(null); } } return $this; }}