<?phpnamespace App\Entity;use ApiPlatform\Core\Annotation\ApiResource;use App\Repository\SupportRepository;use Doctrine\Common\Collections\ArrayCollection;use Doctrine\Common\Collections\Collection;use Doctrine\ORM\Mapping as ORM;#[ORM\Entity(repositoryClass: SupportRepository::class)]#[ApiResource]class Support{ #[ORM\Id] #[ORM\GeneratedValue] #[ORM\Column] private ?int $id = null; #[ORM\Column(length: 255, nullable: true)] private ?string $pdf = null; #[ORM\ManyToOne(inversedBy: 'supports')] #[ORM\JoinColumn(referencedColumnName:"id",onDelete: "CASCADE", name: "virtualclassroom_id")] private ?VirtualClassroom $virtualclassroom = null; #[ORM\Column(length: 255, nullable: true)] private ?string $titre = null; #[ORM\OneToMany(mappedBy: 'support', targetEntity: PDFAccessLog::class)] private Collection $pDFAccessLogs; public function __construct() { $this->pDFAccessLogs = new ArrayCollection(); }// public function __toString(): string// {// return $this->getPdf();// } public function __toString(): string { return $this->getPdf() ?: $this->getVideo() ?: 'Untitled Support'; } public function getId(): ?int { return $this->id; } public function getPdf(): ?string { return $this->pdf; } public function setPdf(?string $pdf): self { $this->pdf = $pdf; return $this; } public function getVirtualclassroom(): ?VirtualClassroom { return $this->virtualclassroom; } public function setVirtualclassroom(?VirtualClassroom $virtualclassroom): self { $this->virtualclassroom = $virtualclassroom; return $this; } public function getTitre(): ?string { return $this->titre; } public function setTitre(?string $titre): self { $this->titre = $titre; return $this; } /** * @return Collection<int, PDFAccessLog> */ public function getPDFAccessLogs(): Collection { return $this->pDFAccessLogs; } public function addPDFAccessLog(PDFAccessLog $pDFAccessLog): self { if (!$this->pDFAccessLogs->contains($pDFAccessLog)) { $this->pDFAccessLogs->add($pDFAccessLog); $pDFAccessLog->setSupport($this); } return $this; } public function removePDFAccessLog(PDFAccessLog $pDFAccessLog): self { if ($this->pDFAccessLogs->removeElement($pDFAccessLog)) { // set the owning side to null (unless already changed) if ($pDFAccessLog->getSupport() === $this) { $pDFAccessLog->setSupport(null); } } return $this; }}