src/Entity/Support.php line 14

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use ApiPlatform\Core\Annotation\ApiResource;
  4. use App\Repository\SupportRepository;
  5. use Doctrine\Common\Collections\ArrayCollection;
  6. use Doctrine\Common\Collections\Collection;
  7. use Doctrine\ORM\Mapping as ORM;
  8. #[ORM\Entity(repositoryClassSupportRepository::class)]
  9. #[ApiResource]
  10. class Support
  11. {
  12.     #[ORM\Id]
  13.     #[ORM\GeneratedValue]
  14.     #[ORM\Column]
  15.     private ?int $id null;
  16.     #[ORM\Column(length255nullabletrue)]
  17.     private ?string $pdf null;
  18.     #[ORM\ManyToOne(inversedBy'supports')]
  19.     #[ORM\JoinColumn(referencedColumnName:"id",onDelete"CASCADE"name"virtualclassroom_id")]
  20.     private ?VirtualClassroom $virtualclassroom null;
  21.     #[ORM\Column(length255nullabletrue)]
  22.     private ?string $titre null;
  23.     #[ORM\OneToMany(mappedBy'support'targetEntityPDFAccessLog::class)]
  24.     private Collection $pDFAccessLogs;
  25.     public function __construct()
  26.     {
  27.         $this->pDFAccessLogs = new ArrayCollection();
  28.     }
  29. //    public function __toString(): string
  30. //    {
  31. //        return $this->getPdf();
  32. //    }
  33.     public function __toString(): string
  34.     {
  35.         return $this->getPdf() ?: $this->getVideo() ?: 'Untitled Support';
  36.     }
  37.     public function getId(): ?int
  38.     {
  39.         return $this->id;
  40.     }
  41.     public function getPdf(): ?string
  42.     {
  43.         return $this->pdf;
  44.     }
  45.     public function setPdf(?string $pdf): self
  46.     {
  47.         $this->pdf $pdf;
  48.         return $this;
  49.     }
  50.     public function getVirtualclassroom(): ?VirtualClassroom
  51.     {
  52.         return $this->virtualclassroom;
  53.     }
  54.     public function setVirtualclassroom(?VirtualClassroom $virtualclassroom): self
  55.     {
  56.         $this->virtualclassroom $virtualclassroom;
  57.         return $this;
  58.     }
  59.     public function getTitre(): ?string
  60.     {
  61.         return $this->titre;
  62.     }
  63.     public function setTitre(?string $titre): self
  64.     {
  65.         $this->titre $titre;
  66.         return $this;
  67.     }
  68.     /**
  69.      * @return Collection<int, PDFAccessLog>
  70.      */
  71.     public function getPDFAccessLogs(): Collection
  72.     {
  73.         return $this->pDFAccessLogs;
  74.     }
  75.     public function addPDFAccessLog(PDFAccessLog $pDFAccessLog): self
  76.     {
  77.         if (!$this->pDFAccessLogs->contains($pDFAccessLog)) {
  78.             $this->pDFAccessLogs->add($pDFAccessLog);
  79.             $pDFAccessLog->setSupport($this);
  80.         }
  81.         return $this;
  82.     }
  83.     public function removePDFAccessLog(PDFAccessLog $pDFAccessLog): self
  84.     {
  85.         if ($this->pDFAccessLogs->removeElement($pDFAccessLog)) {
  86.             // set the owning side to null (unless already changed)
  87.             if ($pDFAccessLog->getSupport() === $this) {
  88.                 $pDFAccessLog->setSupport(null);
  89.             }
  90.         }
  91.         return $this;
  92.     }
  93. }